VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 5205
ClientLeft = 60
ClientTop = 345
ClientWidth = 3975
LinkTopic = "Form1"
ScaleHeight = 5205
ScaleWidth = 3975
StartUpPosition = 3 'Windows Default
Begin VB.TextBox Text1
BackColor = &H80000014&
BorderStyle = 0 'None
Height = 195
Left = 3015
TabIndex = 1
Text = "Text1"
Top = 2205
Width = 1725
End
Begin VB.ListBox List1
Height = 4350
Left = 720
TabIndex = 0
Top = 225
Width = 1815
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim index As IntegerPrivate Sub Form_Load()
Dim x As Integer
For x = 1 To 20
List1.AddItem "hello" & x
Next
List1.Left = 0
List1.Top = 0
Text1.Visible = False
End SubPrivate Sub Form_Resize()List1.Width = Me.Width
List1.Height = Me.Height
End SubPrivate Sub List1_Click()
Text1.Visible = True
index = List1.ListIndex
Text1.Left = List1.Left + 18
If List1.ListCount < Int(List1.Height / Text1.Height) Then
Text1.Width = List1.Width - 10
Else
Text1.Width = List1.Width - 300
End If
Text1.Top = List1.Top + (List1.ListIndex - List1.TopIndex) * Text1.Height + 10
Text1.Text = List1.Text
Text1.SetFocus
Text1.SelStart = 0
Text1.SelLength = Len(Text1)
End SubPrivate Sub Text1_LostFocus()
List1.List(index) = Text1.Text
End Sub
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 5205
ClientLeft = 60
ClientTop = 345
ClientWidth = 3975
LinkTopic = "Form1"
ScaleHeight = 5205
ScaleWidth = 3975
StartUpPosition = 3 'Windows Default
Begin VB.TextBox Text1
BackColor = &H80000014&
BorderStyle = 0 'None
Height = 195
Left = 3015
TabIndex = 1
Text = "Text1"
Top = 2205
Width = 1725
End
Begin VB.ListBox List1
Height = 4350
Left = 720
TabIndex = 0
Top = 225
Width = 1815
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim index As IntegerPrivate Sub Form_Load()
Dim x As Integer
For x = 1 To 20
List1.AddItem "hello" & x
Next
List1.Left = 0
List1.Top = 0
Text1.Visible = False
End SubPrivate Sub Form_Resize()List1.Width = Me.Width
List1.Height = Me.Height
End SubPrivate Sub List1_Click()
Text1.Visible = True
index = List1.ListIndex
Text1.Left = List1.Left + 18
If List1.ListCount < Int(List1.Height / Text1.Height) Then
Text1.Width = List1.Width - 10
Else
Text1.Width = List1.Width - 300
End If
Text1.Top = List1.Top + (List1.ListIndex - List1.TopIndex) * Text1.Height + 10
Text1.Text = List1.Text
Text1.SetFocus
Text1.SelStart = 0
Text1.SelLength = Len(Text1)
End SubPrivate Sub Text1_LostFocus()
List1.List(index) = Text1.Text
End Sub
又让你捡个便宜,多少天没“哈哈--”笑了?谢谢我吧!!!
hnlzh(吸海垂虹)
一定要用文本框吗,可不可以直接修改啊 ,这么长----,我看不懂
List1.AddItem "item1"
List1.AddItem "item2"
List1.AddItem "item3"
List1.AddItem "item4"
End SubPrivate Sub Command1_Click()
List1.List(1) = "item_new"
End Sub
我的意思是不要COMMAND,----什么都不要,直接在上面修改
List1.List(List1.ListIndex) = InputBox("New Value:", "Input Please", List1.List(List1.ListIndex))
End Sub
这样也不行的,如果用户不想修改,岂不是也要弹出INPUTBOX?
List1.List(List1.ListIndex) = InputBox("New Value:", "Input Please", List1.List(List1.ListIndex))
End Sub
哦,这样倒是可以,谢谢你啊,我现在很穷,就剩几分了,等我富有了,一定加分给你