vb.net编写记事本richtextbox.find方法第二个参数值是介于0与0之间是什么意思?真巧,其实我也在写记事本哦,我写出来了查找的代码,你参考下
Private Sub 查找ToolStripMenuItem_Click_1(sender As Object, e As EventArgs) Handles 查找ToolStripMenuItem.Click
'Dim fp As String
'fp = InputBox("请输入您要找的字符串", "寻找")
'If fp = "" Then
'MsgBox("您未输入字符串或者已取消!", MsgBoxStyle.Information)
'Else
'If InStr(RichTextBox1.Text, fp) Then
'Dim lines() As String = RichTextBox1.Lines
'Dim index As Integer = RichTextBox1.Find(fp, 0, RichTextBoxFinds.MatchCase)
'Dim targetline As Integer = RichTextBox1.GetLineFromCharIndex(index)
'Else
'MsgBox("未找到您输入的字符串!", MsgBoxStyle.Critical)
'End If
'End If
fp = InputBox("请输入您要找的字符串", "寻找")
If fp = "" Then
MsgBox("您未输入字符串或者已取消!", MsgBoxStyle.Information)
Else
If InStr(RichTextBox1.Text, fp) Then
Dim start As Integer = RichTextBox1.Find(fp, 0, RichTextBoxFinds.MatchCase)
If start = 0 Then
RichTextBox1.SelectionStart = start
RichTextBox1.SelectionLength = fp.Length
starta = startfp.Length1
Else
End If
Else
MsgBox("未找到您输入的字符串!", MsgBoxStyle.Critical)
End If
End If
End Sub
你试一下 , 我这里是可以运行的
VB.NET中的所有数据文件均可用记事本打开?这个?。?呵呵,应该不难吧先找到你要打开的应用程序的文件然后用一个调用代码:System.Diagnostics.Process.Start("C:\WINDOWS\system32\notepad.exe")这是要开记事本的System.Diagnostics.Process.Start("C:\WINDOWS\system32\calc.exe")这是打开计算器的应该也可以把这两个应用程序复制到你的程序的默认目录下 , 就是BIN下吧!呵呵,试试?。∫壹臃峙叮 。。?
vb .net 程序怎么默认打开txt记事本文件?楼下的根本不对 。exe右键是没有“打开方式”的,也没必要因为这个问题而还原系统 。把exe设置为直接运行 , 方法:新建一个txt文件,输入ftype exefile="%1" %*,保存,把扩展名改为bat , 双击这个文件 , 就好了 。
VB.net怎么才能实现记事本中的查找上一个的功能(在Richtextbox中)?查找一次后记入查找内容的位置,百查找下一个功能度 这时候的开始位置就是刚才查找内容的位置加上查找内容的长度 , 版突出显示其实就是选权定文本 , 富文本框有SelectionStart,SelectionLength 两个属性
怎么用VB.NET做一个记事本Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
OpenFileDialog1.ShowDialog()
RichTextBox1.LoadFile(Me.OpenFileDialog1.FileName, RichTextBoxStreamType.PlainText)
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim fname As String
Me.SaveFileDialog1.ShowDialog()
fname = Me.SaveFileDialog1.FileName
If (fname"") Then
If (Me.OpenFileDialog1.FilterIndex = 1) Then
Me.RichTextBox1.SaveFile(fname, RichTextBoxStreamType.PlainText)
Else
Me.RichTextBox1.SaveFile(fname, RichTextBoxStreamType.RichText)
End If
End If
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
Me.SaveFileDialog2.ShowDialog()
If (Me.OpenFileDialog1.FileName"") Then
If (Me.OpenFileDialog1.FilterIndex = 1) Then
Me.RichTextBox1.SaveFile(Me.SaveFileDialog2.FileName, RichTextBoxStreamType.PlainText)
Else
Me.RichTextBox1.SaveFile(Me.SaveFileDialog2.FileName, RichTextBoxStreamType.RichText)
End If
End If
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Me.FontDialog1.Font = Me.RichTextBox1.SelectionFont
If (Me.FontDialog1.ShowDialog() = Me.DialogResult.OK) Then
Me.RichTextBox1.SelectionFont = Me.FontDialog1.Font
End If
End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
Me.ColorDialog1.Color = Me.RichTextBox1.SelectionColor
If (Me.ColorDialog1.ShowDialog() = Me.DialogResult.OK) Then
Me.RichTextBox1.SelectionColor = Me.ColorDialog1.Color
End If
End Sub
Private Sub 打开ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 打开ToolStripMenuItem.Click
Try
Dim str As String
Dim typel As System.Windows.Forms.RichTextBoxStreamType
OpenFileDialog1.ShowDialog()
str = OpenFileDialog1.FileName
RichTextBox1.LoadFile(str, RichTextBoxStreamType.PlainText)
Catch ex As Exception
End Try
End Sub
Private Sub 保存ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 保存ToolStripMenuItem.Click
Me.SaveFileDialog1.ShowDialog()
If (Me.SaveFileDialog1.FileName"") Then
If (Me.OpenFileDialog1.FilterIndex = 1) Then
Me.RichTextBox1.SaveFile(Me.SaveFileDialog1.FileName, RichTextBoxStreamType.PlainText)
Else
Me.RichTextBox1.SaveFile(Me.SaveFileDialog1.FileName, RichTextBoxStreamType.RichText)
End If
End If
End Sub
Private Sub 另存为ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 另存为ToolStripMenuItem.Click
Me.SaveFileDialog1.ShowDialog()
If (Me.OpenFileDialog1.FileName"") Then
If (Me.OpenFileDialog1.FilterIndex = 1) Then
Me.RichTextBox1.SaveFile(Me.SaveFileDialog1.FileName, RichTextBoxStreamType.PlainText)
Else
Me.RichTextBox1.SaveFile(Me.SaveFileDialog1.FileName, RichTextBoxStreamType.RichText)
End If
End If
End Sub
Private Sub 退出ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 退出ToolStripMenuItem.Click
End
End Sub
Private Sub 字体ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 字体ToolStripMenuItem.Click
Me.FontDialog1.Font = Me.RichTextBox1.SelectionFont
If (Me.FontDialog1.ShowDialog() = Me.DialogResult.OK) Then
Me.RichTextBox1.SelectionFont = Me.FontDialog1.Font
End If
End Sub
Private Sub 颜色ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 颜色ToolStripMenuItem.Click
Me.ColorDialog1.Color = Me.RichTextBox1.SelectionColor
If (Me.ColorDialog1.ShowDialog() = Me.DialogResult.OK) Then
Me.RichTextBox1.SelectionColor = Me.ColorDialog1.Color
End If
End Sub
Private Sub SaveFileDialog1_FileOk(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles SaveFileDialog1.FileOk
End Sub
End Class
怎样在VB .NET中调用记事本和计算器这个?。?呵呵,应该不难吧
先找到你要打开的应用程序的文件
然后用一个调用代码:
System.Diagnostics.Process.Start("C:\WINDOWS\system32\notepad.exe")
这是要开记事本的
System.Diagnostics.Process.Start("C:\WINDOWS\system32\calc.exe")
这是打开计算器的
应该也可以把这两个应用程序复制到你的程序的默认目录下,就是BIN下吧!
呵呵,试试?。∫壹臃峙叮 。。?
【vb.net记事本的简单介绍】关于vb.net记事本和的介绍到此就结束了,不知道你从中找到你需要的信息了吗 ?如果你还想了解更多这方面的信息,记得收藏关注本站 。
推荐阅读
- 孟回是什么电视,孟回是哪部电视剧
- 抖音直播用什么电视好呢,抖音直播电视剧用什么软件
- 游戏主播直播间如何连麦,游戏直播的时候怎么互动
- c语言转换二进制函数 c语言转化为二进制函数
- linux命令改etc的简单介绍
- 安卓手机战地五下载安装,战地五手机版下载安装
- css3设置下变阴影,css如何设置阴影
- throw函数c语言 c++中throw的用法
- flutter小红点,flutter消息小红点