真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

vb.net記事本源碼的簡(jiǎn)單介紹

VB.NET做一個(gè)類似記事本的可執(zhí)行文件,保存時(shí)不知道怎么用代碼設(shè)置保存類型(文件擴(kuò)展名)

算了,都貼上,你自己看吧:

創(chuàng)新互聯(lián)公司是一家集網(wǎng)站建設(shè),湘西土家族企業(yè)網(wǎng)站建設(shè),湘西土家族品牌網(wǎng)站建設(shè),網(wǎng)站定制,湘西土家族網(wǎng)站建設(shè)報(bào)價(jià),網(wǎng)絡(luò)營(yíng)銷,網(wǎng)絡(luò)優(yōu)化,湘西土家族網(wǎng)站推廣為一體的創(chuàng)新建站企業(yè),幫助傳統(tǒng)企業(yè)提升企業(yè)形象加強(qiáng)企業(yè)競(jìng)爭(zhēng)力??沙浞譂M足這一群體相比中小企業(yè)更為豐富、高端、多元的互聯(lián)網(wǎng)需求。同時(shí)我們時(shí)刻保持專業(yè)、時(shí)尚、前沿,時(shí)刻以成就客戶成長(zhǎng)自我,堅(jiān)持不斷學(xué)習(xí)、思考、沉淀、凈化自己,讓我們?yōu)楦嗟钠髽I(yè)打造出實(shí)用型網(wǎng)站。

//設(shè)置文件類型

//書寫規(guī)則例如:txt?files(*.txt)|*.txt

saveFileDialog.Filter?=?"txt?files(*.txt)|*.txt|xls?files(*.xls)|*.xls|All?files(*.*)|*.*"

//設(shè)置默認(rèn)文件名(可以不設(shè)置)

saveFileDialog.FileName?=?"siling-Data"

//主設(shè)置默認(rèn)文件extension(可以不設(shè)置)

saveFileDialog.DefaultExt?=?"xml"

//獲取或設(shè)置一個(gè)值,該值指示如果用戶省略擴(kuò)展名,文件對(duì)話框是否自動(dòng)在文件名中添加擴(kuò)展名。(可以不設(shè)置)

saveFileDialog.AddExtension?=?true

//設(shè)置默認(rèn)文件類型顯示順序(可以不設(shè)置)

saveFileDialog.FilterIndex?=?2

//保存對(duì)話框是否記憶上次打開的目錄

saveFileDialog.RestoreDirectory?=?true

VB編寫記事本

vb編寫的簡(jiǎn)單記事本代碼

Dim b As String

Dim a As String

Dim m As String

Dim x As String

Private Declare Function SetWindowPos Lib "user32" ( _

ByVal hwnd As Long, _

ByVal hWndInsertAfter As Long, _

ByVal x As Long, ByVal Y As Long, _

ByVal cx As Long, ByVal cy As Long, _

ByVal wFlags As Long _

) As Long

Const HWND_TOPMOST = -1

Const SWP_SHOWWINDOW = H40

Private Sub baocun_Click()

Dim abc As String

If Len(Trim(m)) = 0 Then

m = "f:"

End If

abc = m "\" Text2.Text ".txt"

Open abc For Output As #1

Write #1, Text1.Text

Close #1

Label2.Caption = "保存的路徑為:" m "\" Text2.Text ".txt"

a = MsgBox("保存成功!" Chr(13) "是否退出程序", 4 + 64 + 0, "提示")

If a = vbYes Then

End

End If

End Sub

Private Sub Command1_Click()

Dir1.Visible = False

Drive1.Visible = False

m = Dir1.Path

Command1.Visible = False

b = MsgBox("你選的文件夾是:" m, vbYesNo + vbDefaultButton1 + 48, "提示")

If b = vbNo Then

Dir1.Visible = True

Drive1.Visible = True

Command1.Visible = True

Else

Dir1.Visible = False

Drive1.Visible = False

Command1.Visible = False

End If

End Sub

Private Sub Command2_Click()

MsgBox (App.Path + "1.ico")

End Sub

Private Sub dakai_Click()

CommonDialog1.Filter = "文本文件(*.txt)|*.txt"

CommonDialog1.ShowOpen

Open CommonDialog1.FileName For Input As #1

Dim abc As String

linefromfile = StrConv(InputB(LOF(1), 1), vbUnicode)

Text1.Text = linefromfile

Close #1

End Sub

Private Sub Drive1_Change()

Dir1.Path = Drive1.Drive

End Sub

Private Sub Form_Load()

Drive1.Drive = "f:\"

Dir1.Visible = False

Drive1.Visible = False

Command1.Visible = False

Dim fullpath As String

If Right(App.Path, 1) = "\" Then

fullpath = App.Path + "1.ico"

Else

fullpath = App.Path + "\" + "1.ico"

Form1.Icon = LoadPicture(fullpath)

End If

End Sub

Private Sub lingcunwei_Click()

Dim abc As String

CommonDialog1.ShowSave

If Len(Trim(CommonDialog1.FileName)) 0 Then

x = CommonDialog1.FileName

Else

x = "f:\1.txt"

End If

Open x For Append As #1

Write #1, Text1.Text

Close #1

End Sub

Private Sub s_Click()

Text1.FontSize = 5

End Sub

Private Sub sanhao_Click()

Text1.FontSize = 12

End Sub

Private Sub st_Click()

CommonDialog1.ShowFont

End Sub

Private Sub shybcdwjj_Click()

Dir1.Visible = True

Drive1.Visible = True

Command1.Visible = True

End Sub

Private Sub Text2_GotFocus()

Dir1.Visible = False

Drive1.Visible = False

Command1.Visible = False

End Sub

Private Sub tuichu_Click()

End

End Sub

Private Sub wh_Click()

Text1.FontSize = 10

End Sub

Private Sub whs_Click()

Text1.FontSize = 10.5

End Sub

Private Sub xinjian_Click()

Text1.Text = ""

Text2.Text = ""

End Sub

Private Sub yh_Click()

Text1.FontSize = 24

End Sub

Private Sub zstj_Click()

MsgBox "所有字?jǐn)?shù)為" Len(Text1.Text), , " 字?jǐn)?shù)"

End Sub

Private Sub ztys_Click()

CommonDialog1.ShowColor

Text1.ForeColor = CommonDialog1.Color

End Sub

Private Sub zzqm_Click()

Dim retValue As Long

'將窗體設(shè)置為處于所有窗口的頂層,注意在 VB 中運(yùn)行時(shí),可能不行,但編譯成EXE后就可以了

retValue = SetWindowPos(Me.hwnd, HWND_TOPMOST, Me.CurrentX, Me.CurrentY, 380, 615, SWP_SHOWWINDOW)

End Sub

用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("請(qǐng)輸入要查找的字詞:")

Dim Where1 '獲取需要查找的字符串變量

Text1.SetFocus '文本框獲得焦點(diǎn),以顯示所找到的內(nèi)容Search = InputBox("請(qǐng)輸入要查找的字詞:")

Where1 = InStr(Text1.Text, Search) '在文本中查找字符串

If Where1 Then

'若找到則設(shè)置選定的起始位置并使找到的字符串高亮

Text1.SelStart = Where1 - 1

Text1.SelLength = Len(Search)

' Me.Caption = Where1 '測(cè)試用

'否則給出提示

Else: MsgBox "未找到所要查找的字符串。", vbInformation, "提示"

End If

End Sub

Private Sub findNextMenu_Click()

Dim Where2

Dim StartMe As Integer '查找的起始位置變量

Text1.SetFocus '文本框獲得焦點(diǎn)

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) "文本編輯器版本號(hào)1.0" Chr(13) "由西南財(cái)經(jīng)大學(xué)天府學(xué)院" Chr(13) Space(5) "肖忠 開發(fā)" Chr(13) Space(2) "copyright:天府學(xué)院"

End Sub

Private Sub allMenu_Click()

Text1.SelStart = 0

Text1.SelLength = Len(Text1.Text)

End Sub

Private Sub backcolorMenu_Click() '設(shè)置背景色代碼

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程序源碼如何使用

你需要安裝vb6.0開發(fā)軟件

如果安裝了,就可以直接打開源碼測(cè)試了,后綴名是vbp,(就是vb的工程文件)

如果沒有安裝vb6.0,還想打開源碼看程序,那就右擊 用記事本 打開后綴名為frm的文件,他是vb的窗口文件,源碼都在他里面

一般得源碼是沒有生成exe可執(zhí)行文件的,那樣文件太多,太大,浪費(fèi)空間

如果你自己想生成exe可執(zhí)行文件,那就vb6.0得文件菜單中把文件保存成exe可執(zhí)行文件就可以了,非常簡(jiǎn)單

好運(yùn)!


新聞名稱:vb.net記事本源碼的簡(jiǎn)單介紹
文章起源:http://weahome.cn/article/dscioch.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部