vb6.0做的ip地址输入框控件
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了vb6.0做的ip地址输入框控件相关的知识,希望对你有一定的参考价值。
参考技术A Private Declare Function CreateWindowEx Lib "user32" Alias "CreateWindowExA" (ByVal dwExStyle As Long, ByVal lpClassName As String, ByVal lpWindowName As String, ByVal dwStyle As Long, ByVal X As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hWndParent As Long, ByVal hMenu As Long, ByVal hInstance As Long, lpParam As Any) As LongPrivate Declare Function MoveWindow Lib "user32" (ByVal hwnd As Long, ByVal X As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal bRepaint As Long) As Long
Private Declare Function SendMessage Lib "user32.dll" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Declare Function GetStockObject Lib "gdi32.dll" (ByVal nIndex As Long) As Long
Private Declare Sub CopyMemory Lib "kernel32.dll" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long)
Private Const DEFAULT_GUI_FONT As Long = 17本回答被提问者采纳
VB如何把文件内容显示在文本框中?
就是类似记事本一样的,我用Text1.Text=的方法不行,Open F.FiLenaMe又找不到路径,F是控件
VB6.0可以使用TextBok控件或RichTextBox控件实现将读入文本文件显示于控件中。
TextBox 控件有时也称作编辑字段或者编辑控件,显示设计时输入的用户输入的、或运行时在代码中赋予控件的信息。
为了在 TextBox 控件中显示多行文本,要将 MultiLine 属性设置为
True。如果多行 TextBox 没有水平滚动条,那么即使 TextBox 调整了大小,文本也会自动换行。为了在
TextBox 上定制滚动条组合,需要设置 ScrollBars 属性。
如果文本框的 MultiLine 属性设置为 True 而且它的
ScrollBars 没有设置为 None (0),则滚动条总出现在文本框上。
如果将 MultiLine 属性设置为 True,则可以在 TextBox 内用 Alignment 属性设置文本的对齐。如果 MultiLine 属性是 False,则
Alignment 属性不起作用。
代码实例:
Private Sub Command1_Click()
Dim strj() As String
\' 设置“CancelError”为 True
CommonDialog1.CancelError = True
On Error GoTo ErrHandler
\' 设置标志
CommonDialog1.Flags = cdlOFNHideReadOnly
\' 设置过滤器
CommonDialog1.Filter = "All Files (*.*)|*.*|Text Files" & "(*.txt)|*.txt|Batch Files (*.bat)|*.bat"
\' 指定缺省的过滤器
CommonDialog1.FilterIndex = 2
\' 显示“打开”对话框
CommonDialog1.ShowOpen
\' 显示选定文件的名字
Debug.Print CommonDialog1.FileName
Str = CommonDialog1.FileName
Open CommonDialog1.FileName For Input As #1
Do Until EOF(1)
Line Input #1, s
Text1.Text = Text1.Text & s & vbCrLf
Loop
Close #1
Exit Sub
ErrHandler:
Exit Sub
End Sub
RichTextBox 控件不仅允许输入和编辑文本,同时还提供了标准 TextBox
控件未具有的、更高级的指定格式的许多功能。
上述代码同样适合RichTextBox控件使用
Private Sub Command1_Click()
F.Filter = "文本文档(*.txt)|*.txt"
F.FileName = ""
F.ShowOpen
If F.FileName = "" Then Enit Sub
getfreefile = FreeFile
Open F.FileName For Input As #getfreefile
Do While Not EOF(getfreefile)
Line Input #1, readfile
Text1.Text = Text1.Text & readfile & vbCrLf
Loop
Close #getfreefile
End Sub本回答被提问者采纳
以上是关于vb6.0做的ip地址输入框控件的主要内容,如果未能解决你的问题,请参考以下文章