Results 1 to 7 of 7

Thread: checkbox help!!!!

  1. #1
    Guest
    mainfrm.Caption = chkfrm.Check1.Value
    'if check1 is selected, it will tell you 1
    'if not, than it will return 0
    etc. etc.

    Understand?

  2. #2
    New Member
    Join Date
    Mar 2000
    Location
    Rotterdam, Zuid-Holland, Netherlands
    Posts
    12
    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

  3. #3
    Hyperactive Member parkes's Avatar
    Join Date
    Jan 1999
    Location
    Unitied Kingdom
    Posts
    303
    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
    Thanks in advance for any help provided.

    VB 6 Enterprise Edition SP4
    ADO, SQL 7/2000, ASP and some JavaScript


    >> Life goes on, but for how long? <<
    If you can smile when things go wrong, you have someone in mind to blame

  4. #4
    New Member
    Join Date
    Mar 2000
    Location
    Rotterdam, Zuid-Holland, Netherlands
    Posts
    12
    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

  5. #5
    Frenzied Member Jop's Avatar
    Join Date
    Mar 2000
    Location
    Amsterdam, the Netherlands
    Posts
    1,986
    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..
    Doesn't this code work? (in the popup form?)
    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
    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))

    This will return 1 for checked and 0 for unchecked, you could also do

    Code:
    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
    to make it a bit easier for the user

    [Edited by Jop on 10-03-2000 at 09:22 AM]
    Jop - validweb.nl

    Alcohol doesn't solve any problems, but then again, neither does milk.

  6. #6
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    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

    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  7. #7
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    ' 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]
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width