導航:首頁 > 源碼編譯 > vbnet項目源碼

vbnet項目源碼

發布時間:2022-08-25 08:24:16

Ⅰ 跪求VB.net的小作品源代碼,要完整的

不管什麼代碼都可以嗎?我倒是有一個小的不能再小的代碼,是把窗體上的內容生成一個word文檔

Ⅱ 用vb.net編寫記事本源代碼

Dim sFileName As String
Dim Search

Private Sub dateTimeMenu_Click()

Text1.Text = Now

End Sub

Private Sub deleteMenu_Click()
Text1.Text = Left(Text1.Text, Text1.SelStart) + Mid(Text1.Text, Text1.SelStart + Text1.SelLength + 1)
End Sub

Private Sub findMenu_Click()
Search = InputBox("請輸入要查找的字詞:")
Dim Where1 '獲取需要查找的字元串變數
Text1.SetFocus '文本框獲得焦點,以顯示所找到的內容Search = InputBox("請輸入要查找的字詞:")
Where1 = InStr(Text1.Text, Search) '在文本中查找字元串
If Where1 Then
'若找到則設置選定的起始位置並使找到的字元串高亮
Text1.SelStart = Where1 - 1
Text1.SelLength = Len(Search)
' Me.Caption = Where1 '測試用
'否則給出提示
Else: MsgBox "未找到所要查找的字元串。", vbInformation, "提示"
End If
End Sub
Private Sub findNextMenu_Click()
Dim Where2
Dim StartMe As Integer '查找的起始位置變數

Text1.SetFocus '文本框獲得焦點
StartMe = Text1.SelLength + Text1.SelStart + 1 '給變數賦值
Where2 = InStr(StartMe, Text1.Text, Search) '令其從上次找到的地方找起

If Where2 Then
Text1.SelStart = Where2 - 1
Text1.SelLength = Len(Search)

Else: MsgBox "未找到所要查找的字元串.", vbInformation, "提示"
End If

End Sub

Private Sub aboutMenu_Click()
MsgBox Space(2) & "文本編輯器版本號1.0" & Chr(13) & "由西南財經大學天府學院" & Chr(13) & Space(5) & "肖忠 開發" & Chr(13) & Space(2) & "right:天府學院"
End Sub

Private Sub allMenu_Click()
Text1.SelStart = 0
Text1.SelLength = Len(Text1.Text)
End Sub

Private Sub backcolorMenu_Click() '設置背景色代碼
Form1.CommonDialog1.Action = 3
Text1.BackColor = Form1.CommonDialog1.Color
End Sub

Private Sub colorMenu_Click() '改變文字顏色代碼
Form1.CommonDialog1.Action = 3
Text1.ForeColor = Form1.CommonDialog1.Color
End Sub

Private Sub cutMenu_Click()
Clipboard.SetText Text1.SelText
Text1.Text = Left(Text1.Text, Text1.SelStart) + Mid(Text1.Text, Text1.SelStart + Text1.SelLength + 1)
End Sub

Private Sub exitMenu_Click()
End
End Sub

Private Sub fontMenu_Click() '字體菜單代碼
Form1.CommonDialog1.Flags = 3 Or 256
Form1.CommonDialog1.Action = 4
If Len(Form1.CommonDialog1.FontName) = 0 Then
Form1.Text1.FontName = "宋體"
Else
Form1.Text1.FontName = Form1.CommonDialog1.FontName
End If
Form1.Text1.FontSize = Form1.CommonDialog1.FontSize
If Form1.CommonDialog1.FontBold = True Then
Form1.Text1.FontBold = True
Else
Form1.Text1.FontBold = False
End If
If Form1.CommonDialog1.FontItalic = True Then
Form1.Text1.FontItalic = True
Else
Form1.Text1.FontItalic = False
End If
Text1.ForeColor = Form1.CommonDialog1.Color
End Sub

Private Sub Form_Load()
Form1.Text1.Width = Form1.Width - 130
Form1.Text1.Height = Form1.Height
End Sub

Private Sub Form_Resize()
Form1.Text1.Width = Form1.Width - 130
Form1.Text1.Height = Form1.Height
End Sub

Private Sub help1Menu_Click()
Form1.CommonDialog1.HelpCommand = cdlHelpForceFile
Form1.CommonDialog1.HelpFile = "c:\windows\system32\winhelp.hlp"
CommonDialog1.ShowHelp
End Sub

Private Sub newMenu_Click()
If Len(Trim(Text1.Text)) = 0 Then
Form1.Caption = "我的記事本" & "--" & "未命名"
sFileName = "未命名"
Text1.FontSize = 15
Text1.FontName = "宋體"
Text1.Text = ""
Else
Call saveAsMenu_Click
Form1.Caption = "我的記事本" & "--" & "未命名"
sFileName = "未命名"
Text1.FontSize = 15
Text1.FontName = "宋體"
Text1.Text = ""
End If
End Sub

Private Sub openMenu_Click() '打開文件代碼
If Len(Trim(Text1.Text)) = 0 Then
Form1.Caption = "我的記事本"
Form1.CommonDialog1.Filter = "文本文件|*.txt"
Form1.CommonDialog1.Flags = 4096
Form1.CommonDialog1.Action = 1
If Len(Form1.CommonDialog1.FileName) > 0 Then
sFileName = Form1.CommonDialog1.FileName
Form1.Caption = Form1.Caption & "--" & Form1.CommonDialog1.FileTitle
Open sFileName For Input As #1
Text1.FontSize = 15
Text1.FontName = "宋體"
Do While Not EOF(1)
Line Input #1, Text$
All$ = All$ + Text$ + Chr(13) + Chr(10)
Loop
Text1.Text = All
Close #1
End If
Else
Call saveAsMenu_Click
Form1.Caption = "我的記事本"
Form1.CommonDialog1.Filter = "文本文件|*.txt"
Form1.CommonDialog1.Flags = 4096
Form1.CommonDialog1.Action = 1
If Len(Form1.CommonDialog1.FileName) > 0 Then
sFileName = Form1.CommonDialog1.FileName
Form1.Caption = Form1.Caption & "--" & Form1.CommonDialog1.FileTitle
Open sFileName For Input As #1
Text1.FontSize = 15
Text1.FontName = "宋體"
Do While Not EOF(1)
Line Input #1, Text$
All$ = All$ + Text$ + Chr(13) + Chr(10)
Loop
Text1.Text = All
Close #1
End If
End If
End Sub

Private Sub pasteMenu_Click() '粘貼菜單代碼
Text1.Text = Left(Text1.Text, Text1.SelStart) + Clipboard.GetText() + Mid(Text1.Text, Text1.SelStart + Text1.SelLength + 1)
End Sub

Private Sub printMenu_Click()
Form1.CommonDialog1.ShowPrinter
For i = 1 To CommonDialog1.Copies
Printer.Print Text1.Text
Printer.Print Text1.Text
Next
Printer.EndDoc

End Sub

Private Sub saveAsMenu_Click() '另存為菜單代碼
If Len(Trim(Text1.Text)) > 0 Then
Form1.CommonDialog1.DialogTitle = "保存文件"
Form1.CommonDialog1.InitDir = "D:\"
Form1.CommonDialog1.Filter = "文本文件|*.txt"
Form1.CommonDialog1.Flags = 2
Form1.CommonDialog1.ShowSave

If Len(Form1.CommonDialog1.FileName) > 0 Then
sFileName = Form1.CommonDialog1.FileName
Open sFileName For Output As #1
whole$ = Text1.Text
Print #1, whole
Close #1
End If
End If
End Sub

Private Sub saveMenu_Click()
If Len(Trim(Text1.Text)) > 0 Then
Form1.CommonDialog1.DialogTitle = "保存文件"
Form1.CommonDialog1.InitDir = "D:\"
Form1.CommonDialog1.FileName = "新建文本"
Form1.CommonDialog1.Filter = "文本文件|*.txt"
Form1.CommonDialog1.Flags = 2
Form1.CommonDialog1.ShowSave

If Len(Form1.CommonDialog1.FileName) > 0 Then
sFileName = Form1.CommonDialog1.FileName
Open sFileName For Output As #1
whole$ = Text1.Text
Print #1, whole
Close #1
End If
End If
End Sub

Private Sub statusMenu_Click()

End Sub

Ⅲ vb.net排課程序源碼,必有高分報答。

Dim cnstr As String = "連接字串"
Using cnn As New SqlClient.SqlConnection(cnstr)
cnn.Open()
Using da As New SqlClient.SqlDataAdapter("select * from tb where id <@id order by id", cnn), tb As New DataTable
' @id是查詢傳遞的參數。order BY ID 就是排序了。
da.SelectCommand.Parameters.Add("@id", SqlDbType.Int).Value = 10
da.Fill(tb)

'以下為顯示數據
Dim dgv As New DataGridView
dgv.DataSource = tb
dgv.Dock = DockStyle.Fill
Me.Controls.Add(dgv)

End Using
End Using

Ⅳ 求vb.net的源代碼,最好說明其解決問題,越多越好,滿意加50分。

下面這段代碼,是我用來計算每個月存500元進銀行,連續30年,最後連本帶利能有多少錢。這裡面涉及復利計算。界面中右邊的文本框用來輸出每一次計算的結果。


Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim nianxian As Integer '年限變數

Dim dingcun As Integer '定存變數

Dim fuli_big As Long '大復利

Dim fuli_small As Long '小復利

Dim i As Integer '循環變數

Dim DATAstring As String '數據字元串


nianxian = Val(年限_TextBox.Text)

dingcun = Val(定存_TextBox.Text)

DATAstring = ""


For i = 1 To nianxian

fuli_small = dingcun * (1 + 0.1875)

dingcun = fuli_small

fuli_big = fuli_big + fuli_small

DATAstring = DATAstring + "[" + Trim(Str(i)) + "]" + Str(fuli_big) + Chr(13) + Chr(10)

'DATAstring = DATAstring + "[" + Trim(Str(i)) + "]" + Str(fuli_small) + Chr(13) + Chr(10)

Next

'fuli_big = fuli_small

TextBox1.Text = DATAstring

結果_TextBox.Text = Str(fuli_big) + "元"

End Sub


Ⅳ vb.net源碼網站

洪恩在線:http://www.hongen.com/pc/program/codedown/vbcode/
天新網:http://www.21tx.com/src/vb/
VB:http://www.21tx.com/src/vb/

Ⅵ 如何用vb.net獲得網頁的源代碼

Dim url As String=" 網址"

Dim httpReq As System.Net.HttpWebRequest

Dim httpResp As System.Net.HttpWebResponse

Dim httpURL As New System.Uri(url)

httpReq = CType(WebRequest.Create(httpURL), HttpWebRequest)

httpReq.Method = "GET"

httpResp = CType(httpReq.GetResponse(), HttpWebResponse)

httpReq.KeepAlive = False ' 獲取或設置一個值,該值指示是否與
Internet資源建立持久連接。

Dim reader As StreamReader = _

New StreamReader(httpResp.GetResponseStream,

System.Text.Encoding.GetEncoding(-0))

Dim respHTML As String = reader.ReadToEnd() 'respHTML就是網頁源代碼

閱讀全文

與vbnet項目源碼相關的資料

熱點內容
泡沫APP在哪裡下載 瀏覽:937
簡述高級語言進行編譯全過程 瀏覽:39
管家婆輝煌2加密狗挪到另一台電腦 瀏覽:760
摩托車在哪裡app看考題 瀏覽:356
蘋果5app在哪裡設置 瀏覽:737
如何查看伺服器的磁碟使用 瀏覽:165
python蒙特卡洛模型投點圖 瀏覽:330
安卓手機屬於什麼介面 瀏覽:742
微信群推廣網站源碼 瀏覽:764
九江離鷹潭源碼 瀏覽:719
python可以當作函數的返回值 瀏覽:422
地鐵逃生體驗服怎麼進入安卓 瀏覽:833
齊魯工惠app的中獎記錄在哪裡 瀏覽:759
linuxkill命令詳解 瀏覽:104
dhcp伺服器動態分配地址 瀏覽:265
門禁卡加密了能破解嗎 瀏覽:215
在哪裡下載百度網盤app 瀏覽:917
伺服器要升級什麼意思 瀏覽:831
銀行還房貸解壓方法 瀏覽:702
伺服器主機辦公如何提速 瀏覽:920