文本框 TextBox1
創(chuàng)新互聯(lián)主要業(yè)務(wù)有網(wǎng)站營(yíng)銷(xiāo)策劃、網(wǎng)站設(shè)計(jì)、網(wǎng)站建設(shè)、微信公眾號(hào)開(kāi)發(fā)、小程序設(shè)計(jì)、H5場(chǎng)景定制、程序開(kāi)發(fā)等業(yè)務(wù)。一次合作終身朋友,是我們奉行的宗旨;我們不僅僅把客戶(hù)當(dāng)客戶(hù),還把客戶(hù)視為我們的合作伙伴,在開(kāi)展業(yè)務(wù)的過(guò)程中,公司還積累了豐富的行業(yè)經(jīng)驗(yàn)、營(yíng)銷(xiāo)型網(wǎng)站資源和合作伙伴關(guān)系資源,并逐漸建立起規(guī)范的客戶(hù)服務(wù)和保障體系。
上一條 Button1
下一條 Button2
修改 Button3
Imports?System.IO
Public?Class?Form1
Dim?currIndex?As?Integer?=?0
Dim?s2?As?List(Of?String)?=?New?List(Of?String)
Dim?s?As?String
Private?Sub?Form1_Load(ByVal?sender?As?System.Object,?ByVal?e?As?System.EventArgs)?Handles?MyBase.Load
s?=?File.ReadAllText(Application.StartupPath??"\txt.txt")
Dim?s1?As?String()?=?s.Split("@")
For?i?As?Integer?=?0?To?s1.Length?-?1
If?s1(i).Trim()??""?Then
s2.Add("@"??s1(i))
End?If
Next
TextBox1.Text?=?s2(0)
End?Sub
Private?Sub?Button2_Click(ByVal?sender?As?System.Object,?ByVal?e?As?System.EventArgs)?Handles?Button2.Click
currIndex?=?currIndex?+?1
If?currIndex??s2.Count?-?1?Then
MsgBox("已經(jīng)是最后條了")
Return
End?If
TextBox1.Text?=?s2(currIndex)
End?Sub
Private?Sub?Button1_Click(ByVal?sender?As?System.Object,?ByVal?e?As?System.EventArgs)?Handles?Button1.Click
currIndex?=?currIndex?-?1
If?currIndex??0?Then
MsgBox("已經(jīng)是第一條了")
Return
End?If
TextBox1.Text?=?s2(currIndex)
End?Sub
Private?Sub?Button3_Click(ByVal?sender?As?System.Object,?ByVal?e?As?System.EventArgs)?Handles?Button3.Click
s2(currIndex)?=?TextBox1.Text
s?=?""
For?i?As?Integer?=?0?To?s2.Count?-?1
s?=?s2(i)
Next
File.WriteAllText(Application.StartupPath??"\txt.txt",?s)
End?Sub
End?Class
批量替換word文檔中的內(nèi)容的方法:?jiǎn)?dòng)Word文檔軟件。按Ctrl+O打開(kāi)需要修改的文件。打開(kāi)需要修改的文件后,在word菜單欄點(diǎn)擊“替換”按鈕。在彈出的替換對(duì)話(huà)框中:首選查找到需要替換的內(nèi)容,再輸入替換為的內(nèi)容。然后點(diǎn)擊“全部替換”即可,如圖所示:
Filter 屬性設(shè)置當(dāng)前文件名篩選字符串,該字符串確定出現(xiàn)在對(duì)話(huà)框的“文件類(lèi)型”框中的選項(xiàng)。
openFileDialog1.InitialDirectory = "c:\\" ;
openFileDialog1.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*" ;
openFileDialog1.FilterIndex = 1 ; // 獲取或設(shè)置文件對(duì)話(huà)框中當(dāng)前選定篩選器的索引;
openFileDialog1.RestoreDirectory = true ;
對(duì)于每個(gè)篩選選項(xiàng),篩選器字符串都包含篩選器說(shuō)明,后接一垂直線(xiàn)條 (|) 和篩選器模式。不同篩選選項(xiàng)的字符串由垂直線(xiàn)條隔開(kāi)。
將以下代碼保存到模塊中:
Declare Function GetPrivateProfileString Lib "kernel32" Alias _
"GetPrivateProfileStringA" (ByVal lpApplicationName As String, _
ByVal lpKeyName As Any, _
ByVal lpDefault As String, _
ByVal lpReturnedString As String, _
ByVal nSize As Long, _
ByVal lpFileName As String) As Long
Declare Function WritePrivateProfileStringByKeyName Lib "kernel32" Alias _
"WritePrivateProfileStringA" (ByVal lpApplicationName As String, _
ByVal lpKeyName As String, _
ByVal lpString As String, _
Public Function GetIniParam(NomFichier As String, NomSection As String, NomVariable As String) As String
Dim ReadString As String * 255
Dim returnv As String
Dim mResultLen As Integer
mResultLen = GetPrivateProfileString(NomSection, NomVariable, "(Unassigned)", ReadString, Len(ReadString) - 1, NomFichier)
If IsNull(ReadString) Or Left$(ReadString, 12) = "(Unassigned)" Then
Dim Tempvalue As Variant
Dim Message As String
Message = "配置文件 " NomFichier " 不存在."
returnv = ""
Else
returnv = Left$(ReadString, InStr(ReadString, Chr$(0)) - 1)
End If
GetIniParam = returnv
End Function
Public Function WriteWinIniParam(NomDuIni As String, sLaSection As String, sNouvelleCle As String, sNouvelleValeur As String)
Dim iSucccess As Integer
iSucccess = WritePrivateProfileStringByKeyName(sLaSection, sNouvelleCle, sNouvelleValeur, NomDuIni)
If iSucccess = 0 Then
WriteWinIniParam = False
Else
WriteWinIniParam = True
End If
End Function
調(diào)用方法:
Call WriteWinIniParam(App.Path "\LiveUpdate.ini", "LiveUpdate", "AppName", txtAppName.Text)
txtFile.Text = GetIniParam(App.Path "\LiveUpdate.ini", "LiveUpdate", "FILES1")
標(biāo)題名稱(chēng):vb.net修改文件 vb如何修改文件名
鏈接分享:http://m.newbst.com/article28/hjpdcp.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供定制網(wǎng)站、定制開(kāi)發(fā)、營(yíng)銷(xiāo)型網(wǎng)站建設(shè)、搜索引擎優(yōu)化、App開(kāi)發(fā)、網(wǎng)站收錄
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶(hù)投稿、用戶(hù)轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀(guān)點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話(huà):028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)