SaveFileDialog1.Filter = "文本文檔|*.txt"
創(chuàng)新互聯(lián)是由多位在大型網(wǎng)絡(luò)公司、廣告設(shè)計(jì)公司的優(yōu)秀設(shè)計(jì)人員和策劃人員組成的一個(gè)具有豐富經(jīng)驗(yàn)的團(tuán)隊(duì),其中包括網(wǎng)站策劃、網(wǎng)頁(yè)美工、網(wǎng)站程序員、網(wǎng)頁(yè)設(shè)計(jì)師、平面廣告設(shè)計(jì)師、網(wǎng)絡(luò)營(yíng)銷(xiāo)人員及形象策劃。承接:成都網(wǎng)站設(shè)計(jì)、網(wǎng)站制作、外貿(mào)營(yíng)銷(xiāo)網(wǎng)站建設(shè)、網(wǎng)站改版、網(wǎng)頁(yè)設(shè)計(jì)制作、網(wǎng)站建設(shè)與維護(hù)、網(wǎng)絡(luò)推廣、數(shù)據(jù)庫(kù)開(kāi)發(fā),以高性價(jià)比制作企業(yè)網(wǎng)站、行業(yè)門(mén)戶平臺(tái)等全方位的服務(wù)。
If SaveFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
FileOpen(1, SaveFileDialog1.FileName, IO.FileMode.Open, OpenAccess.Write)
For i As Integer = 0 To ListBox1.Items.Count - 1
Print(1, ListBox1.Items(i).ToString)
Next
FileClose(1)
End If
1 生成txt文件。
DimSaveFileDialog1AsNewSaveFileDialog()?'創(chuàng)建一個(gè)保存對(duì)話框
SaveFileDialog1.Filter?="txt?files?(*.txt)|*.txt"?'設(shè)置團(tuán)升山擴(kuò)展名
IfSaveFileDialog1.ShowDialog()?=?System.Windows.Forms.DialogResult.OKThen?'塌中如果確定保存
My.Computer.FileSystem.WriteAllText(SaveFileDialog1.Filename,?Textbox1.Text,False)?'保存文本,False表示笑含不追加文本,直接覆蓋其內(nèi)容
EndIf
原文鏈接:
'代碼中Button控件自行在窗體中添加并改名
***********************************父窗體代碼:
Public Class Form1
Public Sub From1_保存Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles From1_保存Button.Click
Select Case sender.name
Case "From1_保存Button"
MsgBox("提交的窗體是From1")
Case "Form2_提交Button"
MsgBox("提交的窗體是From2")
End Select
Form2.Close()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button_顯示子窗體.Click
Form2.ShowDialog()
End Sub
End Class
***********************************子窗體代碼:
Public Class Form2
Private Sub Form2_提交Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Form2_提交Button.Click
Form1.From1_保存Button_Click(Form2_提旦吵交Button, New System.EventArgs)
End Sub
End Class
***********************************
方法滿多的,起碼三四種碰段,笑遲譽(yù)比如用一個(gè)全局變量保存當(dāng)前提交窗體名,執(zhí)行操作的代碼讀取這個(gè)全局變量就行。最方便的應(yīng)該是做過(guò)程
Public Sub DateBaseAdd(ByVal From As Form)
,然后父窗體跟子窗體都能調(diào)用這個(gè)全局過(guò)程,同時(shí)傳入窗體名稱(chēng)