vb.net写的半自动发文章软件

原创 maro  2013-02-06 10:03 

最近工作重点主要是发外媒的软文外链,工作量比较大所以想写一个小工具减轻下

本来想写一个直接post的软件,可惜还要抓包什么的,博主对此一窍不通,只好写一个类似于自动填表的东西,减少下复制粘贴的手动过程

大致步骤是 读取数据库内文章,然后列表,点击列表内文章自动填表。
Imports System.Data
Imports System.Data.OleDb

Public Class data '连接Access 数据
Dim recno As Integer
Dim str As String = System.IO.Directory.GetCurrentDirectory & "\dbCustomer.mdb"
Dim con As New OleDbConnection("provider=microsoft.jet.oledb.4.0;data source='" & str & "'")
Dim cmd As New OleDbCommand("Select * from tblcustomer", con)
Dim da As New OleDbDataAdapter(cmd)
Dim ds As New DataSet()

Private Sub data_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
da.Fill(ds, "tblcustomer")
DataGridView1.DataSource = ds.Tables("tblcustomer") '读取文章数据到DataGridView控件
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
WebBrowser1.Navigate(TextBox1.Text)
End Sub
Public sTemp(99) As String
Private Sub DataGridView1_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellContentClick
If e.ColumnIndex < 0 Or e.RowIndex < 0 Then Exit Sub '点击自动填表
ReDim sTemp(99)
sTemp(0) = DataGridView1.Item(0, e.RowIndex).Value
sTemp(1) = DataGridView1.Item(1, e.RowIndex).Value
sTemp(2) = DataGridView1.Item(2, e.RowIndex).Value
WebBrowser1.Document.All("title").SetAttribute("value", sTemp(1))
My.Computer.Clipboard.SetText(sTemp(2)) '因为内容不能写入,只好复制到剪切板来用,多了一个粘贴的过程
End Sub
End Class

本文地址:http://blog.xmaro.com/archives/499.html
版权声明:本文为原创文章,版权归 maro 所有,欢迎分享本文,转载请保留出处!

发表评论


表情

  1. 梦月酱
    梦月酱 【村长】 @回复

    还没放假?

    • maro
      maro【站长】 @回复

      7号才放假 悲催啊