hazejean Posted July 18, 2003 Posted July 18, 2003 I have a form with 5 check boxes. I f check box 3 is checked I want to display a secondary form. I know how to do it in 6.0...but it does not work in .net. Also how do you add a text box to a checkbox to allow user to add free text? Also have code for this in 6.0 that doesn't work in .net. Thanks Quote
bfellwock Posted July 28, 2003 Posted July 28, 2003 Do you want the new form to be spawned exactly when the checkbox is checked on? Also, if you could post your VB6 code it would help. Thanks, Bart. Quote
hazejean Posted July 28, 2003 Author Posted July 28, 2003 VB6 code below Private Sub check1_Click() If check1.Value = 1 Then formx.Visible = 1 Else formx.Visible = 0 End Sub Private Sub check3_Click() If check3.Value = 1 Then form3.Visible = 1 Else form3.Visible = 0 End Sub Quote
*Experts* mutant Posted July 28, 2003 *Experts* Posted July 28, 2003 To open another form: 'dim the form somwhere Dim SecondForm As New Form2 'then wherever you want to show it If checkbox3.Checked Then SecondForm.Show() Else SecondForm.Visible = False End If What do you mean "add free text"? Let the user edit the text of the checkbox? Quote
hazejean Posted July 28, 2003 Author Posted July 28, 2003 I have several checkboxes with captions. The last one is called "other" it is followed by a Text box where the user can enter his own text. sample vb6 code below: 'model5 verb1 = "one" verb2 = "two" verb3 = "three" verb4 = "four" verb5 = Trim(other1.text) check1.Caption = verb1 check2.Caption = verb2 check3.Caption = verb3 check4.Caption = verb4 check5.Caption = "other" Quote
*Experts* mutant Posted July 28, 2003 *Experts* Posted July 28, 2003 You could use the TextChanged or Leave event to change it, or any other way you want. Just put that code in it: CheckBox1.Text = TextBox1.Text Quote
Diablicolic Posted July 28, 2003 Posted July 28, 2003 And if you wanted to move data from Form1 to Form2 go like this: 1) In Form2 add a Private Sub like this: Private Sub Transfer(ByVal intReceived As Integer) If intReceived = Nothing Then intReceived = 0 End If TextBox1.Text = "I ate " & intReceived & " apples." End Sub 2) In the event that causes intReceived to be Transfered from Form1, add this code there in Form1: Dim intThrow As Integer intThrow = 2 Dim Form2 As New Form2 Form2.Transfer(intThrow) 'Referring to the Private Sub in Form2 'intThrow will be transferred to Form2, and be put into intReceived 3) And so the event in Form1 should transfer the integer intThrow in Form1 to intReceived in Form2. If you have any questions please ask. Quote "Reality is fake, Dreams are for real"
Incognetosoft Posted July 29, 2003 Posted July 29, 2003 Easy! Dim frmForm2 as new form2 If checkbox1.checked=true Then frmForm2.showdialog Thats for .net Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.