问一个很奇怪的字符串问题
Private Sub Command1_Click()Dim l As Long
Dim T As String
Dim XkTemp As String '* 229
Dim XkString As String '* 229
Dim i As Integer
T = Space$(20)
XkString = ""
XkTemp = "000001"
l = GetPrivateProfileString("TEST", "号码", "", T, 20, "c:\test.ini")
‘T是"123456"
XkTemp = XkTemp & trim(T)
XkTemp = XkTemp & "22"
Text1.Text = XkTemp
End Sub
为什么出来的是000001123456 而不是00000112345622
XkTemp = XkTemp & "22"这句为什么没起作用
Dim XkString As String '* 229 后面加上*数字有什么作用 不加又怎么样 --------------------编程问答-------------------- Dim XkString As String * 229
意思是指定字符串的长度!这样就是定长字符串!
XkTemp = XkTemp & "22"这句没起作用是不可能的,是不是文本框的长度问题??? --------------------编程问答-------------------- 如果是指定字符串长度的变量 应该这样
XkTemp = Trim(XkTemp) & trim(T)
XkTemp = Trim(XkTemp) & "22" --------------------编程问答-------------------- 注意l = GetPrivateProfileString("TEST", "号码", "", T, 20, "c:\bin.txt")的实际作用
Option Explicit--------------------编程问答-------------------- XkTemp = XkTemp & Trim(T)
Private 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
Private Sub Command1_Click()
Dim l As Long
Dim T As String
Dim XkTemp As String '* 229
Dim XkString As String '* 229
Dim i As Integer
T = "123456"
T = Space$(20) & T
XkString = ""
XkTemp = "000001"
'l = GetPrivateProfileString("TEST", "号码", "", T, 20, "c:\bin.txt")
'T是"123456"
XkTemp = XkTemp & Trim(T)
XkTemp = XkTemp & "22"
Text1.Text = XkTemp
End Sub
XkTemp = Trim(XkTemp) & "22"
--------------------编程问答-------------------- ........路过 --------------------编程问答-------------------- 帮顶
补充:VB , 基础类