VB.NET School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

Welcome to Dream.In.Code
Become a VB.NET Expert!

Join 307,220 VB.NET Programmers for FREE! Get instant access to thousands of VB.NET experts, tutorials, code snippets, and more! There are 1,675 people online right now. Registration is fast and FREE... Join Now!




Radio buttons in Group boxes?

 

Radio buttons in Group boxes?, Trying to assign the radio buttons in a group to an array!

Cowsi

10 Nov, 2008 - 08:49 PM
Post #1

New D.I.C Head
*

Joined: 10 Nov, 2008
Posts: 4

Hello,

So, I'm working on a small survey program that students have to fill out. There are a total of three different forms on the same page, as the user clicks "Next" on each of the forms, the next form will become visible once all the required data fields are filled out in the form prior. Right now form 1 works perfectly, and even prompts messagebox.show for missed fields. Form one, just consists of the students information, which course their registered in, who the instructor is and etc.

The second form is where I'm stuck on. Currently their are 13 questions to be filled out, where by the students rate the question on a scale of 1 to 5 with 6 being "Not applicable". I have put the 6 radio buttons for each question, in its own group box. These group boxes are labeled "Q1GBox1", "Q2GBox2"...."Q13GBox13". Their are a total of 78 radio buttons (6 * 13 = 78), labeled "RButton1", "RButton2"..."Rbutton65". The 6th Radio button for each group box has a different label of "R6Button1", "R6Button2"..."R6Button13".

The problem is this, I need to ensure that all questions are answered and so I need to check the radio buttons some how using a loop or an array of some sort. I don't know how I go about assigning the radio buttons of each question to an array, and then verify if in fact they were checked.

The final form, form 3 has to display the results of the survey which I can mange to do myself with a bit more reading of the textbook.


Another hard part to the program:
I also need a guru to show me how I can store the values of the survey into a text file.




CODE


Option Explicit On
Option Strict On


Public Class CourseBox

    'Declaring variables for Group Box 1 - Information
    Private school As String
    Private faculty As String
    Private proff As String
    Private subj As String
    Private courNum As String
    Private section As String

    'Declaring variables for Box 2 - Survey Questions?
  





    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NextButton1.Click

        'Assigning user inputs to variables for Group Box 1 - Information
        school = CStr(Me.SchoolBox.Text)
        faculty = CStr(Me.FacultyBox.Text)
        proff = CStr(Me.ProffBox.Text)
        subj = CStr(Me.SubjBox.Text)
        courNum = CStr(Me.CourNumBox.Text)
        section = CStr(Me.SectionBox.Text)

        'Prompt error message for missed input fields
        'and send the cursor to the missed field
        If String.IsNullOrEmpty(Me.SchoolBox.Text) Then
            MessageBox.Show("Please enter the school offering the course.")
            Me.SchoolBox.Focus()
        End If

        If String.IsNullOrEmpty(Me.FacultyBox.Text) Then
            MessageBox.Show("Please enter which faculty the course is offered in.")
            Me.FacultyBox.Focus()
        End If

        If String.IsNullOrEmpty(Me.ProffBox.Text) Then
            MessageBox.Show("Please enter the instructor for the course.")
            Me.ProffBox.Focus()
        End If

        If String.IsNullOrEmpty(Me.SubjBox.Text) Then
            MessageBox.Show("Please enter the subject.")
            Me.SubjBox.Focus()
        End If

        If String.IsNullOrEmpty(Me.CourNumBox.Text) Then
            MessageBox.Show("Please enter the course number.")
            Me.CourNumBox.Focus()
        End If

        If String.IsNullOrEmpty(Me.SectionBox.Text) Then
            MessageBox.Show("Please enter the course section.")
            Me.SectionBox.Focus()
        End If

        'Ensuring that all fields have inputs prior to moving
        'forward to the next section
        If String.IsNullOrEmpty(Me.SchoolBox.Text) = False _
           AndAlso String.IsNullOrEmpty(Me.FacultyBox.Text) = False _
           AndAlso String.IsNullOrEmpty(Me.ProffBox.Text) = False _
           AndAlso String.IsNullOrEmpty(Me.SubjBox.Text) = False _
           AndAlso String.IsNullOrEmpty(Me.CourNumBox.Text) = False _
           AndAlso String.IsNullOrEmpty(Me.SectionBox.Text) = False Then
            GBox1.Visible = False
            GBox2.Visible = True
        End If

    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BackButton.Click

        GBox2.Visible = False
        GBox1.Visible = True

    End Sub

    Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        'Disabling visibility of form's not required at start up
        GBox2.Visible = False
        GBox3.Visible = False


    End Sub

    Private Sub NextButton2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles SubmitButton.Click
    
    End Sub

    Private Sub GBox2_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GBox2.Enter

    End Sub
End Class




Advanced thanks to one and all...


















User is offlineProfile CardPM
+Quote Post



Fast ReplyReply to this topicStart new topic

Time is now: 11/21/09 10:27PM

Live VB.NET Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

VB.NET Tutorials

Reference Sheets

VB.NET Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month