Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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

  • 2 weeks later...
Posted

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

  • *Experts*
Posted

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?

Posted

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"

  • *Experts*
Posted

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

Posted

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.

"Reality is fake, Dreams are for real"

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...