mainfrm.Caption = chkfrm.Check1.Value
'if check1 is selected, it will tell you 1
'if not, than it will return 0
etc. etc.
Understand?
Printable View
mainfrm.Caption = chkfrm.Check1.Value
'if check1 is selected, it will tell you 1
'if not, than it will return 0
etc. etc.
Understand?
and where do i put the code for that?
do i add that in the application form or in the form where i have placed the checkboxes?
greetz
You would put it in the form with the check boxes, either under a seperate command button that transfers the information or within the Click event of the check box
okay done that..
but now comes the next problem.
I have a txtbox in the application form
if i select a checkbox in that popupform with some data,
how do i pass that on then to the txtbox.
i've tried a few things like changing the mainnfrm.Caption tot txtbox.Caption, but i have this feeling that doesn't work.. :)
greetz
Doesn't this code work? (in the popup form?)Quote:
how do i pass that on then to the txtbox.
i've tried a few things like changing the mainnfrm.Caption tot txtbox.Caption, but i have this feeling that doesn't work..
Be sure to make the Check1 and the Text1 a control array (by copying and pasting the first checkbox and textbox and pasting it a few times(if VB ask to create a control array press yes))Code:Private Sub Form_Unload(Cancel As Integer)
Static x As Integer
For x = Check1.LBound To Check1.UBound
Text1(x).Text = Check1(x).Value
Next
End Sub
This will return 1 for checked and 0 for unchecked, you could also do
to make it a bit easier for the userCode:Static x As Integer, cu As String
For x = 0 To Check1.UBound
If Check1(x).Value = 1 Then
cu = "Checked"
Else
cu = "Unchecked"
End If
Text1(x).Text = cu
Next
[Edited by Jop on 10-03-2000 at 09:22 AM]
As this Q is vauge, exactly what information are you trying to pass the caption of the checkbox or what the caption of
the checkbox refers to.
Ie. Checkbox1 has a capiton of Read Text4.Text
Are you trying to pass Read Text4.text or what is in Text4.Text
' forget your project for a moment and make a new one
'do exactly as outlined and then you can see how it works
'then go back to your project once you get the feel of it
'and change your code to reflect what you have learned.
'
'Good luck
[code]
'create a new standard project
'add 2 textboxes Text1 and Text2
'add a command button Command1
'
'copy and paste this code into form 1
'
Option Explicit
Private Sub Command1_Click()
Form1.Hide
Form2.Show
End Sub
Private Sub Form_Load()
Text1.Width = Form1.Width
Text2.Width = Form1.Width
Text1.Left = 0
Text2.Left = 0
Text1.Top = 0
Text2.Top = 1200
Text1.Text = ""
Text2.Text = ""
Command1.Caption = "Go To 2"
Form1.Caption = "Here I am on 1"
End Sub
'add form2 and add one textbox frm2Text1
'add 1 checkbox frm2Check1
'add 1 command button frm2cmdReturn
'copy & Paste this code into form 2
Option Explicit
Private Sub Form_Load()
Text1.Left = 0
Text1.Top = 0
Text1.Width = Form2.Width
frm2Check1.Width = 6000
frm2Check1.Caption = "Hello, I am the Checkbox Caption"
frm2cmdReturn.Caption = "Return"
frm2Text1.Text = "I am text1 on form 2"
Form2.Caption = "Hello, I am Form2.Caption"
End Sub
Private Sub frm2cmdReturn_Click()
Form2.Hide
Form1.Show
Form1.Text1.Text = frm2Check1.Caption
Form1.Text2.Text = frm2Text1.Text
Form1.Caption = "Hi, I am " & Form2.Caption & " from Form2"
End Sub
[code]