Home > Software engineering > In VB6.0 by use of how a form pops up another form, and then returns a value of another form
In VB6.0 by use of how a form pops up another form, and then returns a value of another form
Time:10-04
So I have a form 1, click on one of the button pop-up window 2.
Form 2 a listview, I chose one of the few lines, and save the results into a public variable,
Now I want to be in the form of 2 closed, will the results back to the form of the common variables 1 textbox1.
But I found that I always textbox1. Text=bomstr FrmBomList again. Show, The textbox1 text is always empty, how to get to the values in the form 2 (bomstr)? Or am I wrong?
Private Sub getBomInfo () Dim bomlist As FrmBomList FrmBomList. Show Textbox1. Text=bomstr END SUB
The form 2
Public bomstr As String Private Sub Command2_Click () Bomstr=""
If ListView1. ListItems. Count & lt; 1 Then Dim As Integer I I=MsgBox (" the Part no information, please confirm, 16, "tip") 'message box tip The Else Dim PartInfo As String PartInfo="" For I=0 To ListView1. ListItems. Count - 1 'If ListView1. ListItems (I + 1) Checked=True Then If ListView1. ListItems. Item (I + 1) Checked=True Then PartInfo=PartInfo + CStr (ListView1 ListItems (I + 1). SubItems (1)) + ", "' I + 1 to define the number of rows End the If 'I=I + 1 Next If Len (PartInfo) & gt;=1 Then Text1. Text=Mid (PartInfo, 1, Len (PartInfo) - 1) Bomstr=Text1. Text End the If End the If End Sub
CodePudding user response:
FrmBomList. Show 1
CodePudding user response:
Thank the great god reply upstairs, I also tried this method, which is ascribed value, then frm2 pop-up, select data in FRM or affect frm1 results
CodePudding user response:
You build a moudle, built a global variable
CodePudding user response:
I'm sorry, write wrong, is to create a module
CodePudding user response:
Add a form1 in Form2. Text1. Text=bomstr
CodePudding user response:
In From2 command2 event finally add a: From1, Text1. Text=bomstr should be ok