hello
I want to take data ( number) from text box on second form ,and break running for first form
when second form closed , the first form continue it running
this code for first form

public  number  As Integer
    dim numofcondition as form

   Private Sub button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button1.Click
      numofcondition=new form2
numofcondition.show()
       
       for i as integer =1 to number
       
text1=new textbox
text1.location=new point(5,25+(i*19))
me.controls.add(text1)
       end for

    End Sub

this code for second form

Private Sub button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button1.Click

number=int(textbox1.text)
me.close()

end sub

please help

Use this:

My.Forms.secondForm.textbox1.Text = Cstr(number)
My.Forms.secondForm.textbox1.Text = Cstr(number)

this statment retrieve the value of number and converted it to string
write ??

my problem , the running of form1 continue before cloding of second form
I want to break it running when form2 activated > and when I close form2 ,form1 will continue from break point

in code the program will not show any textbox because it not take the value from textbox,it continue before the user enter the value

I think OP didn't explain his/her question.

my problem , the running of form1 continue before cloding of second form I want to break it running when form2 activated > and when I close form2 ,form1 will continue from break point

Try Visible property - Hide/Show.

I tried on Hide/show properety
but the problem still
I want to know how to wait for a form to close before executing the rest of the code?
i executing a sub procedure, and during this sub i need (not always though!) the user to give me some extra information.

so i created a form with some textboxes, but the first sub should wait until the user presses OK or Cancel on the new form.

how do i make the sub procedure wait ??

also I tried this , but when the second form runs , the program not response

public  number  As Integer    
public close_form as boolean=false
dim numofcondition as form    
Private Sub button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button1.Click      numofcondition=new form2numofcondition.show()        for i as integer =1 to number text1=new textboxtext1.location=new point(5,25+(i*19))me.controls.add(text1)       end for     End Subpublic  number  As Integer
    dim numofcondition as form

   Private Sub button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button1.Click
      numofcondition=new form2
numofcondition.show()
       while close_form=false
end while
       for i as integer =1 to number
       
text1=new textbox
text1.location=new point(5,25+(i*19))
me.controls.add(text1)
       end for

    End Sub
Private Sub button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button1.Click number=int(textbox1.text)me.close() end sub  Private Sub button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button1.Click

number=int(textbox1.text)
close_form=true
me.close()

end sub

>I want to know how to wait for a form to close before executing the rest of the code?
Use ShowDialog() Method.

thanks so much
that's help me

Ok... well you could do a while statement of some sorts.
While Form 2 is open, Form 1 is looping in a while statement. When Form 2 is closed then Form 1 ends the while command and continues on.

I'm not sure of the best way to do it though. Some experts might have a better idea.

see the five reply
I used while loop
but the app stop responding ..
I think showdialog better
thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.