Italbro5
asked on
VB Radio BUtton QUestions
Hi experts
i got a form with a number of questions
for each question, there are 5 radio buttons
When they click on the radio button, i save the .caption into a txt file :
For Each ctl In Me.Controls
If (TypeOf ctl Is OptionButton) Then
If ctl.Value = True Then
Print #ff, ctl.Caption
ctl.Value = False
End If
End If
Next ctl
now i need to make sure that each questions as 1 radio button clicked.
how can i do that ??
thx
i got a form with a number of questions
for each question, there are 5 radio buttons
When they click on the radio button, i save the .caption into a txt file :
For Each ctl In Me.Controls
If (TypeOf ctl Is OptionButton) Then
If ctl.Value = True Then
Print #ff, ctl.Caption
ctl.Value = False
End If
End If
Next ctl
now i need to make sure that each questions as 1 radio button clicked.
how can i do that ??
thx
ASKER
Sup Rhaedes
look thats what i have
for each frame, i had 5 control button :
Do While Y < 5
Form1.Controls.Add "VB.OptionButton", "Option" & (d) & (Y), oFrame
Dim oOption As VB.OptionButton
Set oOption = Form1.Controls("Option" & (d) & (Y))
With oOption
.Caption = "" & (Y)
.FontSize = 12
.Visible = True
.Left = var_num3
.Top = var_num4 + 130
.Width = 750
.Height = 300
.Alignment = oPicture
End With
Y = Y + 1
Z = Z + 1
var_num3 = var_num3 + 1100
Loop
then i click on a cmdButton and i need to save all the answer in a .txt file. Thats not a problem. what i need is
1- to make sure that in each frame, there is 1 radio button clicked. If one or more is missing, MSGBOX saying , question # .. is not answer, and once there all answer, i can save all the answer into a .txt
all i got to do is make sure there answer or else cant save answers
thx
look thats what i have
for each frame, i had 5 control button :
Do While Y < 5
Form1.Controls.Add "VB.OptionButton", "Option" & (d) & (Y), oFrame
Dim oOption As VB.OptionButton
Set oOption = Form1.Controls("Option" & (d) & (Y))
With oOption
.Caption = "" & (Y)
.FontSize = 12
.Visible = True
.Left = var_num3
.Top = var_num4 + 130
.Width = 750
.Height = 300
.Alignment = oPicture
End With
Y = Y + 1
Z = Z + 1
var_num3 = var_num3 + 1100
Loop
then i click on a cmdButton and i need to save all the answer in a .txt file. Thats not a problem. what i need is
1- to make sure that in each frame, there is 1 radio button clicked. If one or more is missing, MSGBOX saying , question # .. is not answer, and once there all answer, i can save all the answer into a .txt
all i got to do is make sure there answer or else cant save answers
thx
Here is a fairly neat code segment that should do what you want.
Dim BoolCheck As Boolean
Private Sub Check1_Click()
If Check1.Value = vbChecked Then
BoolCheck = True
End If
If Check1.Value = vbUnchecked Then
BoolCheck = False
End If
End Sub
Private Sub Command1_Click()
Dim inI As Integer
Dim BoolMessage(1 To Whatever) As Boolean
Dim inJ As Integer
Dim MessageString As String
Dim inCurrent as integer
For inJ = 1 To Whatever
BoolMessage(inJ) = False
For inI = 1 To 5
inCurrent = (inJ-1)*5 + inI - 1
If Option1(inCurrent).Value = True Then
BoolMessage(inJ) = True
End If
Next inI
If BoolMessage(inJ) = False Then
MessageString = "Question # " + inJ + " is not filled in. Please do so now."
Call msgBox (MessageString,vbInformati on)
Next inJ
End Sub
I think this will do it.
Jacamar
Dim BoolCheck As Boolean
Private Sub Check1_Click()
If Check1.Value = vbChecked Then
BoolCheck = True
End If
If Check1.Value = vbUnchecked Then
BoolCheck = False
End If
End Sub
Private Sub Command1_Click()
Dim inI As Integer
Dim BoolMessage(1 To Whatever) As Boolean
Dim inJ As Integer
Dim MessageString As String
Dim inCurrent as integer
For inJ = 1 To Whatever
BoolMessage(inJ) = False
For inI = 1 To 5
inCurrent = (inJ-1)*5 + inI - 1
If Option1(inCurrent).Value = True Then
BoolMessage(inJ) = True
End If
Next inI
If BoolMessage(inJ) = False Then
MessageString = "Question # " + inJ + " is not filled in. Please do so now."
Call msgBox (MessageString,vbInformati
Next inJ
End Sub
I think this will do it.
Jacamar
ASKER
Jacamar
sorry
but it dosent work
i create evrything dinamicly so it wont work
i dont really understand your code, i tried it but it dosent work.
I need to go over each "Option" & (d) & (Y)
to see if at least one " Y " is checked
thx
sorry
but it dosent work
i create evrything dinamicly so it wont work
i dont really understand your code, i tried it but it dosent work.
I need to go over each "Option" & (d) & (Y)
to see if at least one " Y " is checked
thx
Ok, here is an example I tried that worked. It has 2 frames with 5 options in each frame. Sorry about the about that didn't work. My option array is called
'Option1()' and it ranges from 0 to 9.
Dim BoolCheck As Boolean
Private Sub Command1_Click()
Dim inI As Integer
Dim BoolMessage(1 To 2) As Boolean
Dim inJ As Integer
Dim MessageString As String
Dim inCurrent As Integer
For inJ = 1 To 2
BoolMessage(inJ) = False
For inI = 1 To 5
inCurrent = (inJ - 1) * 5 + inI - 1
If Option1(inCurrent).Value = True Then
BoolMessage(inJ) = True
End If
Next inI
If BoolMessage(inJ) = False Then
MessageString = "Question # " & inJ & " is not filled in. Please do so now."
Call MsgBox(MessageString, vbInformation)
End If
Next inJ
End Sub
If you have problems with this, let me know what specifically is the problem.
Jacamar
'Option1()' and it ranges from 0 to 9.
Dim BoolCheck As Boolean
Private Sub Command1_Click()
Dim inI As Integer
Dim BoolMessage(1 To 2) As Boolean
Dim inJ As Integer
Dim MessageString As String
Dim inCurrent As Integer
For inJ = 1 To 2
BoolMessage(inJ) = False
For inI = 1 To 5
inCurrent = (inJ - 1) * 5 + inI - 1
If Option1(inCurrent).Value = True Then
BoolMessage(inJ) = True
End If
Next inI
If BoolMessage(inJ) = False Then
MessageString = "Question # " & inJ & " is not filled in. Please do so now."
Call MsgBox(MessageString, vbInformation)
End If
Next inJ
End Sub
If you have problems with this, let me know what specifically is the problem.
Jacamar
ASKER
Hi
the thing is that i dont know how many frames i got
so If Option1(inCurrent).Value = True Then will work for only the first two but then it wont work for the other ones.
thats what i have :
"Option" & (d) & (Y)
Option & (1) & (1)
Option & (1) & (2)
Option & (1) & (3)....
Option & (2) & (1)
Option & (2) & (2)....
thx
Italbro
the thing is that i dont know how many frames i got
so If Option1(inCurrent).Value = True Then will work for only the first two but then it wont work for the other ones.
thats what i have :
"Option" & (d) & (Y)
Option & (1) & (1)
Option & (1) & (2)
Option & (1) & (3)....
Option & (2) & (1)
Option & (2) & (2)....
thx
Italbro
ok,
dim inNumFrames as integer
dim inNumOptions as integer
dim BoolMessage() as Boolean
inNumFrames = whatever
Redim BoolMessage(1 to inNumFrames) as Boolean
For inI = 1 to inNumFrames
BoolMessage(inI) = False
Next inI
For inI = 1 to inNumFrames
For inJ = 1 to inNumOptions
if Option & (inI) & (inJ).Value = true then
BoolMessage(inI) = True
end if
Next inJ
Next inI
For inI = 1 to inNumFrames
if BoolMessage (inI) = True then
Call msgBox ("Frame "& inI & " is not filled in", vbinformation)
end if
Next inI
is this going to work for you?
dim inNumFrames as integer
dim inNumOptions as integer
dim BoolMessage() as Boolean
inNumFrames = whatever
Redim BoolMessage(1 to inNumFrames) as Boolean
For inI = 1 to inNumFrames
BoolMessage(inI) = False
Next inI
For inI = 1 to inNumFrames
For inJ = 1 to inNumOptions
if Option & (inI) & (inJ).Value = true then
BoolMessage(inI) = True
end if
Next inJ
Next inI
For inI = 1 to inNumFrames
if BoolMessage (inI) = True then
Call msgBox ("Frame "& inI & " is not filled in", vbinformation)
end if
Next inI
is this going to work for you?
ASKER
Hey
sorry if i bust, but the problem is :
if Option & (inI) & (inJ).Value = true then
this dosent work
cause i create evrything dinamicly so i cant try n find
Option & (inI) & (inJ) cause it dosent exist
you understand ??
thats what i use to save the .caption of each :
Dim ctl As Control
For Each ctl In Me.Controls
If (TypeOf ctl Is OptionButton) Then
If ctl.Value = True Then
Print #ff, ctl.Caption
ctl.Value = False
End If
End If
Next ctl
try and get all the Contols that are Option buttons
its complicated, i just dont see how to do it
thats why i need your help
thx alot
Italbro
sorry if i bust, but the problem is :
if Option & (inI) & (inJ).Value = true then
this dosent work
cause i create evrything dinamicly so i cant try n find
Option & (inI) & (inJ) cause it dosent exist
you understand ??
thats what i use to save the .caption of each :
Dim ctl As Control
For Each ctl In Me.Controls
If (TypeOf ctl Is OptionButton) Then
If ctl.Value = True Then
Print #ff, ctl.Caption
ctl.Value = False
End If
End If
Next ctl
try and get all the Contols that are Option buttons
its complicated, i just dont see how to do it
thats why i need your help
thx alot
Italbro
ok, lets start over. You have a number of frames....each of which contain some options buttons. And you need to make sure that each frame has one option selected before the user is allowed to proceed. How many frames are you going to have? And if you are not sure, how is that going to be determined? Or could it be different every time? What kind of options are these going to be? I think there will be a simpler way to go about doing what you are trying to do.
ASKER
Here it is
i read a text file.
in the .txt file, there are some question
1.1 ..
1.2....
....
for each question, i create a frame + 5 radio-buttons.
THe amount of frames, i dont know, depends how many questions in the .txt file
here's what i have :
Form1.Controls.Add "VB.Frame", "Frame" & (i), Frame1
Dim oFrame As VB.Frame
Set oFrame = Form1.Controls("Frame" & (i))
With oFrame
.BorderStyle = 0
.Height = 500
.Width = 6000
.Left = 100
.Visible = True
.Top = var_num2
End With
Do While Y < 5
Form1.Controls.Add "VB.OptionButton", "Option" & (d) & (Y), oFrame
Dim oOption As VB.OptionButton
Set oOption = Form1.Controls("Option" & (d) & (Y))
With oOption
.Caption = "" & (Y)
.FontSize = 12
.Visible = True
.Left = var_num3
.Top = var_num4 + 130
.Width = 750
.Height = 300
.Alignment = oPicture
End With
thats the code i use to create the frames and radio buttons.
SO i need to make sure that each frame ( every questions ) has one option selected before the user is allowed to proceed ( save all the answers in an other .txt file )
i read a text file.
in the .txt file, there are some question
1.1 ..
1.2....
....
for each question, i create a frame + 5 radio-buttons.
THe amount of frames, i dont know, depends how many questions in the .txt file
here's what i have :
Form1.Controls.Add "VB.Frame", "Frame" & (i), Frame1
Dim oFrame As VB.Frame
Set oFrame = Form1.Controls("Frame" & (i))
With oFrame
.BorderStyle = 0
.Height = 500
.Width = 6000
.Left = 100
.Visible = True
.Top = var_num2
End With
Do While Y < 5
Form1.Controls.Add "VB.OptionButton", "Option" & (d) & (Y), oFrame
Dim oOption As VB.OptionButton
Set oOption = Form1.Controls("Option" & (d) & (Y))
With oOption
.Caption = "" & (Y)
.FontSize = 12
.Visible = True
.Left = var_num3
.Top = var_num4 + 130
.Width = 750
.Height = 300
.Alignment = oPicture
End With
thats the code i use to create the frames and radio buttons.
SO i need to make sure that each frame ( every questions ) has one option selected before the user is allowed to proceed ( save all the answers in an other .txt file )
One thing that would make this a much simpler problem would be if in the textfile you could add a line at the start of the file when it is made. If this were the first line of the file, you could input that value and use it to tell your program how many frames there are. Is this possible?
Or when the questions are being inputed in to the program, you could have a counter to count how many questions there are. You can add a
Counter = Counter + 1
Each time a line is inputed. Or each time a new frame is created.
Will either of these be useful in your case? It will make the code I have above useful since you will beable to set:
inNumFrames = Counter
Once the form is loaded.
Jacamar
Or when the questions are being inputed in to the program, you could have a counter to count how many questions there are. You can add a
Counter = Counter + 1
Each time a line is inputed. Or each time a new frame is created.
Will either of these be useful in your case? It will make the code I have above useful since you will beable to set:
inNumFrames = Counter
Once the form is loaded.
Jacamar
ASKER
Counter = Counter + 1
its a good idea
thats not a problem to do
but the thing is this :
to get the value of the radio button, i do this
Dim ctl As Control
For Each ctl In Me.Controls
If (TypeOf ctl Is OptionButton) Then
If ctl.Value = True Then
Print #ff, ctl.Caption
ctl.Value = False
End If
End If
Next ctl
thats the thing, i cant go for Option(1)(2)...
i need to check
for each frame, in the 5 radio button, one as to be click
its a good idea
thats not a problem to do
but the thing is this :
to get the value of the radio button, i do this
Dim ctl As Control
For Each ctl In Me.Controls
If (TypeOf ctl Is OptionButton) Then
If ctl.Value = True Then
Print #ff, ctl.Caption
ctl.Value = False
End If
End If
Next ctl
thats the thing, i cant go for Option(1)(2)...
i need to check
for each frame, in the 5 radio button, one as to be click
ASKER
you got no choice to use
something like that, cause evrything is create dinamicly
Dim ctl As Control
For Each ctl In Me.Controls
If (TypeOf ctl Is OptionButton) Then
something like that, cause evrything is create dinamicly
Dim ctl As Control
For Each ctl In Me.Controls
If (TypeOf ctl Is OptionButton) Then
if you add the counter = counter + 1, then you should beable to write loops that will be done a certian number of times depending on the counter number.
Since the options buttons will be created as array, won't you beable to use the value of the counter to check them all?
Since the options buttons will be created as array, won't you beable to use the value of the counter to check them all?
what I mean is. Although things will always be created dinamicly, you can still keep track of this through the counter. This can trasform your program to something that is 'static' as far as the variables are concerned
ASKER
JAcamar
i create evrything on form2
i had a button there
what will be the code that i need to use for what i need.
thx
i create evrything on form2
i had a button there
what will be the code that i need to use for what i need.
thx
Ok, once you have the frames and buttons created, you should have value for your counter. This will either have counted the number of buttons you made, or the number of frames you made.
If it is the number of frames, then you can leave it, if it is the number of buttons, then divide that number by 5 so that you will have the number of frames.
ok, now.
dim inI as integer
dim inJ as integer
dim BoolOption() as Boolean
dim BoolMessage as Boolean
dim MessageString as String
Redim BoolOption(1 to Counter) as Boolean
For inI = 1 to Counter
BoolOption(inI) = False
' Each time set this option to false.
For inJ = 1 to 5
If Option(inI)(inJ).value = true then
BoolOption(inI) = True
End if
Next inJ
Next inI
' The above code will go through all frames (inI's), and check all buttons in each frame(inJ's) to make sure one is chosen. If none are chosen in a frame, the 'BoolOption will remain False for that inI. Once this is done, you can do something like
MessageSting = "Please Fill in the Following Questions"
BoolMessage = False
For inI = 1 to Counter
if BoolOption(inI) = False then
BoolMessege = True
MessageString =MessageString & ", " & inI
end if
Next inI
' IF any of the questions are not filled in, then the BoolMessage will be true and it will execute the following.
if BoolMessege = True then
Call msgBox(MessageString, vbinformation)
end if
' And accordingly
if BoolMessege = False then
Call cmdProccessInfo_Click()
end if
Let me know if this works for you.
Jacamar.
If it is the number of frames, then you can leave it, if it is the number of buttons, then divide that number by 5 so that you will have the number of frames.
ok, now.
dim inI as integer
dim inJ as integer
dim BoolOption() as Boolean
dim BoolMessage as Boolean
dim MessageString as String
Redim BoolOption(1 to Counter) as Boolean
For inI = 1 to Counter
BoolOption(inI) = False
' Each time set this option to false.
For inJ = 1 to 5
If Option(inI)(inJ).value = true then
BoolOption(inI) = True
End if
Next inJ
Next inI
' The above code will go through all frames (inI's), and check all buttons in each frame(inJ's) to make sure one is chosen. If none are chosen in a frame, the 'BoolOption will remain False for that inI. Once this is done, you can do something like
MessageSting = "Please Fill in the Following Questions"
BoolMessage = False
For inI = 1 to Counter
if BoolOption(inI) = False then
BoolMessege = True
MessageString =MessageString & ", " & inI
end if
Next inI
' IF any of the questions are not filled in, then the BoolMessage will be true and it will execute the following.
if BoolMessege = True then
Call msgBox(MessageString, vbinformation)
end if
' And accordingly
if BoolMessege = False then
Call cmdProccessInfo_Click()
end if
Let me know if this works for you.
Jacamar.
ASKER
here are my two option JACAMAR
1- either i create a dynamic button = i'm not able to make it work when clicked .. if u can help !!!!!
2- if i create the button my self and add your code on the cmd_click() it wont work because : Option(inI)(inJ) dosent exist. Option()() was create dynamicly so i wont be able to work with it.
your code is exaclty what i need.
thx
Italbro
1- either i create a dynamic button = i'm not able to make it work when clicked .. if u can help !!!!!
2- if i create the button my self and add your code on the cmd_click() it wont work because : Option(inI)(inJ) dosent exist. Option()() was create dynamicly so i wont be able to work with it.
your code is exaclty what i need.
thx
Italbro
ASKER
hey JACAMAR
i made the button work but it dosent work
this code here is not good :
If Option(inI)(inJ).value = true then
it dosent work
i need to paste the code into a button and it gives me an error at the line before.
i think were getting closer but it dosent work
i appreciate your help,
almost done
thx
i made the button work but it dosent work
this code here is not good :
If Option(inI)(inJ).value = true then
it dosent work
i need to paste the code into a button and it gives me an error at the line before.
i think were getting closer but it dosent work
i appreciate your help,
almost done
thx
ASKER
when i said previously : i made the button work but it dosent work
it means, i was able to make the button_click() work but the code inside dosent.
it means, i was able to make the button_click() work but the code inside dosent.
Are you able to create the buttons on the frames on your form?
If so, what are the names of the buttons?
If so, what are the names of the buttons?
ASKER
lol
it think we dont understand each other.
i got a frame.
in the frame i got labels
under each label i got 5 radio-button in a frame
at the end of the frame, i got a cmd_button
when i click on the cmd_button, it checks if on radio button as been click in each frame.
the thing is, i create evrything dynamicly so it dosent recognize the Option(inI)(inJ) so i need to do it a different way
i think i cant be clearer then that
sorry if i give you problem to understand
thx
italbro
it think we dont understand each other.
i got a frame.
in the frame i got labels
under each label i got 5 radio-button in a frame
at the end of the frame, i got a cmd_button
when i click on the cmd_button, it checks if on radio button as been click in each frame.
the thing is, i create evrything dynamicly so it dosent recognize the Option(inI)(inJ) so i need to do it a different way
i think i cant be clearer then that
sorry if i give you problem to understand
thx
italbro
ASKER
i got a BIG FRAME
in the frame i got labels
under each label i got 5 radio-button in a frame to put the radio-buttons together
at the end of the BIG FRAME, i got a cmd_button
when i click on the cmd_button, it checks if on radio button as been click in each frame.
in the frame i got labels
under each label i got 5 radio-button in a frame to put the radio-buttons together
at the end of the BIG FRAME, i got a cmd_button
when i click on the cmd_button, it checks if on radio button as been click in each frame.
ok, and what are the names of these option buttons?
ASKER
i create them dynamicly
Option(inI)(inJ)
Option(inI)(inJ)
Ok, so once they are created, and you have the value for your counter, why can you not use the counter to run loops to check all of Option(inI)(inJ)?
For inI = 1 to Counter
For inJ = 1 to Counter*5
ect.....like I did before?
For inI = 1 to Counter
For inJ = 1 to Counter*5
ect.....like I did before?
ASKER
cause when u create Option(inI)(inJ) dynamicli
u cant do Option(1)(1).value ... it wont work
u cant do Option(1)(1).value ... it wont work
Ok, I gave it a try. I put 15 options on the screen in an array, ctl() and it is redimensioned to ctl(1 to 3, 1 to 5)
These options are not in frames, but it shouldn't make a difference if they are. It goes through and checks in groups of 5's, and messegeboxes pop up to notify which groups of 5 do not have an option selected. Since they are all on the same form in this example, at least 2 pop up. Try this code in a new application and only add a new command button. It works with the dinamically determined options buttons that are:
ctl(inI,inJ)
Dim ctl() As Control
Private Sub Form_Load()
Form1.Width = 10000
Form1.Height = 10000
Dim frm As Form1
Dim lX As Long
Dim lY As Long
Dim lInc As Long
Dim i As Integer
lInc = 400
'create 5 Option Buttons
Counter = 3
ReDim ctl(1 To Counter, 1 To 5)
ReDim ctl1(1 To Counter)
With Form1
For inI = 1 To Counter
For inJ = 1 To 5
Set ctl(inI, inJ) = .Controls.Add("VB.OptionBu tton", "Option" & CStr(inI) & CStr(inJ))
ctl(inI, inJ).Top = lY
ctl(inI, inJ).Left = 100
ctl(inI, inJ).Width = 4000
ctl(inI, inJ).Caption = "This is Option #" & CStr(inJ)
ctl(inI, inJ).Visible = True
lY = lY + lInc
Next inJ
Next inI
End With
Form1.Show vbModal
Set Form1 = Nothing
End Sub
Private Sub Command1_Click()
Dim inI As Integer
Dim inJ As Integer
Dim BoolOption(1 To 3) As Boolean
For inI = 1 To 3
For inJ = 1 To 5
OptionName = "Option" & CStr(inI) & CStr(inJ)
If ctl(inI, inJ).Value = True Then
BoolOption(inI) = True
End If
Next inJ
Next inI
For inI = 1 To 3
If BoolOption(inI) = False Then
Call MsgBox(inI, vbInformation)
End If
Next inI
End Sub
Let me know what happens this time. LOL. Hopefully we are on the same page now.
Jacamar
These options are not in frames, but it shouldn't make a difference if they are. It goes through and checks in groups of 5's, and messegeboxes pop up to notify which groups of 5 do not have an option selected. Since they are all on the same form in this example, at least 2 pop up. Try this code in a new application and only add a new command button. It works with the dinamically determined options buttons that are:
ctl(inI,inJ)
Dim ctl() As Control
Private Sub Form_Load()
Form1.Width = 10000
Form1.Height = 10000
Dim frm As Form1
Dim lX As Long
Dim lY As Long
Dim lInc As Long
Dim i As Integer
lInc = 400
'create 5 Option Buttons
Counter = 3
ReDim ctl(1 To Counter, 1 To 5)
ReDim ctl1(1 To Counter)
With Form1
For inI = 1 To Counter
For inJ = 1 To 5
Set ctl(inI, inJ) = .Controls.Add("VB.OptionBu
ctl(inI, inJ).Top = lY
ctl(inI, inJ).Left = 100
ctl(inI, inJ).Width = 4000
ctl(inI, inJ).Caption = "This is Option #" & CStr(inJ)
ctl(inI, inJ).Visible = True
lY = lY + lInc
Next inJ
Next inI
End With
Form1.Show vbModal
Set Form1 = Nothing
End Sub
Private Sub Command1_Click()
Dim inI As Integer
Dim inJ As Integer
Dim BoolOption(1 To 3) As Boolean
For inI = 1 To 3
For inJ = 1 To 5
OptionName = "Option" & CStr(inI) & CStr(inJ)
If ctl(inI, inJ).Value = True Then
BoolOption(inI) = True
End If
Next inJ
Next inI
For inI = 1 To 3
If BoolOption(inI) = False Then
Call MsgBox(inI, vbInformation)
End If
Next inI
End Sub
Let me know what happens this time. LOL. Hopefully we are on the same page now.
Jacamar
ASKER
LOL
it dosent really do something usefull
try n create the frames and then put the 5 radio buttons.
Now its create 15 radio button, 3 time 1 to 5, but i can check only one on all 15. And then msgbox only 2 numbers, dont really get.
Try and make 2 frames, with 5 radio, then a button and then it will work, thx
italbro
it dosent really do something usefull
try n create the frames and then put the 5 radio buttons.
Now its create 15 radio button, 3 time 1 to 5, but i can check only one on all 15. And then msgbox only 2 numbers, dont really get.
Try and make 2 frames, with 5 radio, then a button and then it will work, thx
italbro
ASKER
i'm gonna need to use something like that
For Each ctl In Me.Controls
If (TypeOf ctl Is OptionButton) Then
i think
For Each ctl In Me.Controls
If (TypeOf ctl Is OptionButton) Then
i think
ASKER
JACAMAR
did you find anything interesting for me
did you find anything interesting for me
Are you able to get your program to create your frames and buttons?
ASKER
JACAMAR
ya
thats not a problem
i read a text file
i had a Frame with 5 Radio Button in the frame
thats not a problem
its to make sure that there all check that i cant do
ya
thats not a problem
i read a text file
i had a Frame with 5 Radio Button in the frame
thats not a problem
its to make sure that there all check that i cant do
ok. The code I gave you yesterday will check the options buttons in groups of 5 to make sure that at least one is checked right?
So when you create your options, why don't you just create them with the same name in a one dimensional array, and I have shown that you can check them that way?
What is your code to create the frames and options now?
So when you create your options, why don't you just create them with the same name in a one dimensional array, and I have shown that you can check them that way?
What is your code to create the frames and options now?
ASKER
this is my code :
Do While Not EOF(1)
var_num3 = 100
Line Input #1, MyString
Dim MyString2
Dim MyString3
MyString2 = Mid(MyString, 1, 1)
MyString3 = Mid(MyString, 3, 1)
If MyString <> "" Then
Form1.Controls.Add "VB.Label", "Label" & (i), Frame1
Dim oLabel As VB.Label
Set oLabel = Form1.Controls("Label" & CStr(i))
With oLabel
.Top = var_num1
.Visible = True
.Caption = MyString
.AutoSize = True
.BorderStyle = 1
.Left = 100
End With
i = i + 1
End If
If MyString3 > 0 And MyString3 < 9 Then
Y = 0
Form1.Controls.Add "VB.Frame", "Frame" & (i), Frame1
Dim oFrame As VB.Frame
Set oFrame = Form1.Controls("Frame" & (i))
With oFrame
.BorderStyle = 0
.Height = 500
.Width = 6000
.Left = 100
.Visible = True
.Top = var_num2
End With
Do While Y < 5
Form1.Controls.Add "VB.OptionButton", "Option" & (d) & (Y), oFrame
Dim oOption As VB.OptionButton
Set oOption = Form1.Controls("Option" & (d) & (Y))
With oOption
.Caption = "" & (Y)
.FontSize = 12
.Visible = True
.Left = var_num3
.Top = var_num4 + 130
bouton = var_num4 + 130
.Width = 750
.Height = 300
.Alignment = oPicture
End With
Y = Y + 1
Z = Z + 1
var_num3 = var_num3 + 1100
Loop
d = d + 1
End If
var_num1 = var_num1 + 800
var_num2 = var_num2 + 800
Loop
i'll try n work on it
but if u have the code for something like this, it would be great
thx
Do While Not EOF(1)
var_num3 = 100
Line Input #1, MyString
Dim MyString2
Dim MyString3
MyString2 = Mid(MyString, 1, 1)
MyString3 = Mid(MyString, 3, 1)
If MyString <> "" Then
Form1.Controls.Add "VB.Label", "Label" & (i), Frame1
Dim oLabel As VB.Label
Set oLabel = Form1.Controls("Label" & CStr(i))
With oLabel
.Top = var_num1
.Visible = True
.Caption = MyString
.AutoSize = True
.BorderStyle = 1
.Left = 100
End With
i = i + 1
End If
If MyString3 > 0 And MyString3 < 9 Then
Y = 0
Form1.Controls.Add "VB.Frame", "Frame" & (i), Frame1
Dim oFrame As VB.Frame
Set oFrame = Form1.Controls("Frame" & (i))
With oFrame
.BorderStyle = 0
.Height = 500
.Width = 6000
.Left = 100
.Visible = True
.Top = var_num2
End With
Do While Y < 5
Form1.Controls.Add "VB.OptionButton", "Option" & (d) & (Y), oFrame
Dim oOption As VB.OptionButton
Set oOption = Form1.Controls("Option" & (d) & (Y))
With oOption
.Caption = "" & (Y)
.FontSize = 12
.Visible = True
.Left = var_num3
.Top = var_num4 + 130
bouton = var_num4 + 130
.Width = 750
.Height = 300
.Alignment = oPicture
End With
Y = Y + 1
Z = Z + 1
var_num3 = var_num3 + 1100
Loop
d = d + 1
End If
var_num1 = var_num1 + 800
var_num2 = var_num2 + 800
Loop
i'll try n work on it
but if u have the code for something like this, it would be great
thx
Ok, i've done a bit of playing around with this. Copy this code, and paste it in to a new application. Put on two new control buttons, Command1 and Command2.
Then give it a try. Make sure you change the name of the text file though.
Dim ctl() As Control
Dim d As Integer
Private Sub Command1_Click()
FileName = App.Path + "\Text.txt"
Open FileName For Input As #1
d = 1
Do While Not EOF(1)
var_num3 = 100
Line Input #1, MyString
Dim MyString2
Dim MyString3
MyString2 = Mid(MyString, 1, 1)
MyString3 = Mid(MyString, 3, 1)
If MyString <> "" Then
Form1.Controls.Add "VB.Label", "Label" & (i)
Dim oLabel As VB.Label
Set oLabel = Form1.Controls("Label" & CStr(i))
With oLabel
.Top = var_num1
.Visible = True
.Caption = MyString
.AutoSize = True
.BorderStyle = 1
.Left = 100
End With
i = i + 1
End If
If MyString3 > 0 And MyString3 < 9 Then
y = 1
Form1.Controls.Add "VB.Frame", "Frame" & (i)
Dim oFrame As VB.Frame
Set oFrame = Form1.Controls("Frame" & (i))
With oFrame
.BorderStyle = 0
.Height = 500
.Width = 6000
.Left = 100
.Visible = True
.Top = var_num2
End With
Do While y < 6
Form1.Controls.Add "VB.OptionButton", "Option" & (d) & (y), oFrame
ReDim ctl(1 To d, 1 To 5) As Control
Set ctl(d, y) = Form1.Controls("Option" & (d) & (y))
With ctl(d, y)
.Caption = "" & (y)
.FontSize = 12
.Visible = True
.Left = var_num3
.Top = var_num4 + 130
bouton = var_num4 + 130
.Width = 750
.Height = 300
.Alignment = oPicture
End With
y = y + 1
Z = Z + 1
var_num3 = var_num3 + 1100
Loop
d = d + 1
End If
var_num1 = var_num1 + 800
var_num2 = var_num2 + 800
Loop
End Sub
Private Sub Command2_Click()
Dim inI As Integer
Dim inJ As Integer
Dim BoolOption() As Boolean
ReDim BoolOption(1 To d)
For inI = 1 To d - 1
For inJ = 1 To 5
OptionName = "Option" & CStr(inI) & CStr(inJ)
Set ctl(inI, inJ) = Form1.Controls("Option" & (inI) & (inJ))
If ctl(inI, inJ) = True Then
BoolOption(inI) = True
End If
Next inJ
Next inI
For inI = 1 To d - 1
If BoolOption(inI) = False Then
Call MsgBox("Please Fill in Question # " & inI, vbInformation)
End If
Next inI
End Sub
Jacamar
Then give it a try. Make sure you change the name of the text file though.
Dim ctl() As Control
Dim d As Integer
Private Sub Command1_Click()
FileName = App.Path + "\Text.txt"
Open FileName For Input As #1
d = 1
Do While Not EOF(1)
var_num3 = 100
Line Input #1, MyString
Dim MyString2
Dim MyString3
MyString2 = Mid(MyString, 1, 1)
MyString3 = Mid(MyString, 3, 1)
If MyString <> "" Then
Form1.Controls.Add "VB.Label", "Label" & (i)
Dim oLabel As VB.Label
Set oLabel = Form1.Controls("Label" & CStr(i))
With oLabel
.Top = var_num1
.Visible = True
.Caption = MyString
.AutoSize = True
.BorderStyle = 1
.Left = 100
End With
i = i + 1
End If
If MyString3 > 0 And MyString3 < 9 Then
y = 1
Form1.Controls.Add "VB.Frame", "Frame" & (i)
Dim oFrame As VB.Frame
Set oFrame = Form1.Controls("Frame" & (i))
With oFrame
.BorderStyle = 0
.Height = 500
.Width = 6000
.Left = 100
.Visible = True
.Top = var_num2
End With
Do While y < 6
Form1.Controls.Add "VB.OptionButton", "Option" & (d) & (y), oFrame
ReDim ctl(1 To d, 1 To 5) As Control
Set ctl(d, y) = Form1.Controls("Option" & (d) & (y))
With ctl(d, y)
.Caption = "" & (y)
.FontSize = 12
.Visible = True
.Left = var_num3
.Top = var_num4 + 130
bouton = var_num4 + 130
.Width = 750
.Height = 300
.Alignment = oPicture
End With
y = y + 1
Z = Z + 1
var_num3 = var_num3 + 1100
Loop
d = d + 1
End If
var_num1 = var_num1 + 800
var_num2 = var_num2 + 800
Loop
End Sub
Private Sub Command2_Click()
Dim inI As Integer
Dim inJ As Integer
Dim BoolOption() As Boolean
ReDim BoolOption(1 To d)
For inI = 1 To d - 1
For inJ = 1 To 5
OptionName = "Option" & CStr(inI) & CStr(inJ)
Set ctl(inI, inJ) = Form1.Controls("Option" & (inI) & (inJ))
If ctl(inI, inJ) = True Then
BoolOption(inI) = True
End If
Next inJ
Next inI
For inI = 1 To d - 1
If BoolOption(inI) = False Then
Call MsgBox("Please Fill in Question # " & inI, vbInformation)
End If
Next inI
End Sub
Jacamar
ASKER
your code looks ok
some spacing to do
one thing do.
if there all answered i need to save all the caption or value into a file.
Print #ff, ctl.Caption
thats what i use to do, but now i need to make sure there all answered
how can i do that
once and only once there all answered i save evrything
some spacing to do
one thing do.
if there all answered i need to save all the caption or value into a file.
Print #ff, ctl.Caption
thats what i use to do, but now i need to make sure there all answered
how can i do that
once and only once there all answered i save evrything
Ok, here is the fixed code that will do that. Take the same steps as before. Just 2 command buttons. I spaced it out a bit for you this time ..... :)
Dim ctl() As Control
Dim d As Integer
Private Sub Command1_Click()
Filename = App.Path + "\Text.txt"
Open Filename For Input As #1
d = 1
Do While Not EOF(1)
var_num3 = 100
Line Input #1, MyString
Dim MyString2
Dim MyString3
MyString2 = Mid(MyString, 1, 1)
MyString3 = Mid(MyString, 3, 1)
If MyString <> "" Then
Form1.Controls.Add "VB.Label", "Label" & (i)
Dim oLabel As VB.Label
Set oLabel = Form1.Controls("Label" & CStr(i))
With oLabel
.Top = var_num1
.Visible = True
.Caption = MyString
.AutoSize = True
.BorderStyle = 1
.Left = 100
End With
i = i + 1
End If
If MyString3 > 0 And MyString3 < 9 Then
y = 1
Form1.Controls.Add "VB.Frame", "Frame" & (i)
Dim oFrame As VB.Frame
Set oFrame = Form1.Controls("Frame" & (i))
With oFrame
.BorderStyle = 0
.Height = 500
.Width = 6000
.Left = 100
.Visible = True
.Top = var_num2
End With
Do While y < 6
Form1.Controls.Add "VB.OptionButton", "Option" & (d) & (y), oFrame
ReDim ctl(1 To d, 1 To 5) As Control
Set ctl(d, y) = Form1.Controls("Option" & (d) & (y))
With ctl(d, y)
.Caption = "" & (y)
.FontSize = 12
.Visible = True
.Left = var_num3
.Top = var_num4 + 130
bouton = var_num4 + 130
.Width = 750
.Height = 300
.Alignment = oPicture
End With
y = y + 1
Z = Z + 1
var_num3 = var_num3 + 1100
Loop
d = d + 1
End If
var_num1 = var_num1 + 800
var_num2 = var_num2 + 800
Loop
Close #1
Command1.Enabled = False
End Sub
Private Sub Command2_Click()
Dim inI As Integer
Dim inJ As Integer
Dim BoolOption() As Boolean
Dim AnswerVal() As Integer
Dim BoolProceed As Boolean
ReDim BoolOption(1 To d)
ReDim AnswerVal(1 To d)
For inI = 1 To d - 1
For inJ = 1 To 5
OptionName = "Option" & CStr(inI) & CStr(inJ)
Set ctl(inI, inJ) = Form1.Controls("Option" & (inI) & (inJ))
If ctl(inI, inJ) = True Then
AnswerVal(inI) = inJ
BoolOption(inI) = True
End If
Next inJ
Next inI
BoolProceed = True
For inI = 1 To d - 1
If BoolOption(inI) = False Then
Call MsgBox("Please Fill in Question # " & inI, vbInformation)
BoolProceed = False
End If
Next inI
If BoolProceed = True Then
Dim Filename As String
Filename = App.Path + "\Answers.txt"
Open Filename For Output As #2
For inI = 1 To d - 1
Print #2, inI; Tab(5); " = ";
Print #2, Tab(9); AnswerVal(inI)
Next inI
Close #2
Call MsgBox("Values have been saved to " & Filename, vbInformation)
End If
End Sub
Let me know how this works.
Dim ctl() As Control
Dim d As Integer
Private Sub Command1_Click()
Filename = App.Path + "\Text.txt"
Open Filename For Input As #1
d = 1
Do While Not EOF(1)
var_num3 = 100
Line Input #1, MyString
Dim MyString2
Dim MyString3
MyString2 = Mid(MyString, 1, 1)
MyString3 = Mid(MyString, 3, 1)
If MyString <> "" Then
Form1.Controls.Add "VB.Label", "Label" & (i)
Dim oLabel As VB.Label
Set oLabel = Form1.Controls("Label" & CStr(i))
With oLabel
.Top = var_num1
.Visible = True
.Caption = MyString
.AutoSize = True
.BorderStyle = 1
.Left = 100
End With
i = i + 1
End If
If MyString3 > 0 And MyString3 < 9 Then
y = 1
Form1.Controls.Add "VB.Frame", "Frame" & (i)
Dim oFrame As VB.Frame
Set oFrame = Form1.Controls("Frame" & (i))
With oFrame
.BorderStyle = 0
.Height = 500
.Width = 6000
.Left = 100
.Visible = True
.Top = var_num2
End With
Do While y < 6
Form1.Controls.Add "VB.OptionButton", "Option" & (d) & (y), oFrame
ReDim ctl(1 To d, 1 To 5) As Control
Set ctl(d, y) = Form1.Controls("Option" & (d) & (y))
With ctl(d, y)
.Caption = "" & (y)
.FontSize = 12
.Visible = True
.Left = var_num3
.Top = var_num4 + 130
bouton = var_num4 + 130
.Width = 750
.Height = 300
.Alignment = oPicture
End With
y = y + 1
Z = Z + 1
var_num3 = var_num3 + 1100
Loop
d = d + 1
End If
var_num1 = var_num1 + 800
var_num2 = var_num2 + 800
Loop
Close #1
Command1.Enabled = False
End Sub
Private Sub Command2_Click()
Dim inI As Integer
Dim inJ As Integer
Dim BoolOption() As Boolean
Dim AnswerVal() As Integer
Dim BoolProceed As Boolean
ReDim BoolOption(1 To d)
ReDim AnswerVal(1 To d)
For inI = 1 To d - 1
For inJ = 1 To 5
OptionName = "Option" & CStr(inI) & CStr(inJ)
Set ctl(inI, inJ) = Form1.Controls("Option" & (inI) & (inJ))
If ctl(inI, inJ) = True Then
AnswerVal(inI) = inJ
BoolOption(inI) = True
End If
Next inJ
Next inI
BoolProceed = True
For inI = 1 To d - 1
If BoolOption(inI) = False Then
Call MsgBox("Please Fill in Question # " & inI, vbInformation)
BoolProceed = False
End If
Next inI
If BoolProceed = True Then
Dim Filename As String
Filename = App.Path + "\Answers.txt"
Open Filename For Output As #2
For inI = 1 To d - 1
Print #2, inI; Tab(5); " = ";
Print #2, Tab(9); AnswerVal(inI)
Next inI
Close #2
Call MsgBox("Values have been saved to " & Filename, vbInformation)
End If
End Sub
Let me know how this works.
Italbro,
How did that work out for you? Is your program moving along now?
Jacamar.
How did that work out for you? Is your program moving along now?
Jacamar.
ASKER
hey Jacamar
i'm working on it, let me try it
i'll post a reply today
thx
i'm working on it, let me try it
i'll post a reply today
thx
ASKER
it looks butyfull
but
few little things i tried n work on them, i screwed evrything up.
1- its not 1 to 5, but 0 - 4
2- it dosent have to say all the # he didnt answer. It says you didnt answert to #3. then he continues, he forgor and other one, didnt answer # 20 .... you know.
3- its not questions 6 but maybe 2.2 or 3.1
after this, its perfect, i think.
i really appreciate your help
when done, a straigth A, and if u want more, i got a couple of more questions that are not close yet,... lol
ciao
but
few little things i tried n work on them, i screwed evrything up.
1- its not 1 to 5, but 0 - 4
2- it dosent have to say all the # he didnt answer. It says you didnt answert to #3. then he continues, he forgor and other one, didnt answer # 20 .... you know.
3- its not questions 6 but maybe 2.2 or 3.1
after this, its perfect, i think.
i really appreciate your help
when done, a straigth A, and if u want more, i got a couple of more questions that are not close yet,... lol
ciao
Yeah, those changes I made, I meant to change back, the 1 to 5, and I just put those messege boxes in so you could see that it was working.
I'm glad you like it, and that it will help. :)
Jacamar
I'm glad you like it, and that it will help. :)
Jacamar
ASKER
Jacamar
these things dont work
can u fix them
the
1-
2-
3-
if u dont mind
i'mt rying now, but i'm screwing things up
thx
these things dont work
can u fix them
the
1-
2-
3-
if u dont mind
i'mt rying now, but i'm screwing things up
thx
ASKER
one last thing with the other 3
can you pus some comments, i'm a bit lost
just little thing, that does that ....
like this i can understand better
thx
Italbro
can you pus some comments, i'm a bit lost
just little thing, that does that ....
like this i can understand better
thx
Italbro
1- and 2- are no problem, but I don't know what you are asking in 3-. Explain that one a bit more.
Ok, try this one now
Dim ctl() As Control
Dim d As Integer
Private Sub Command1_Click()
Filename = App.Path + "\Text.txt"
Open Filename For Input As #1
d = 1
Do While Not EOF(1)
var_num3 = 100
Line Input #1, MyString
Dim MyString2
Dim MyString3
MyString2 = Mid(MyString, 1, 1)
MyString3 = Mid(MyString, 3, 1)
If MyString <> "" Then
Form1.Controls.Add "VB.Label", "Label" & (i)
Dim oLabel As VB.Label
Set oLabel = Form1.Controls("Label" & CStr(i))
With oLabel
.Top = var_num1
.Visible = True
.Caption = MyString
.AutoSize = True
.BorderStyle = 1
.Left = 100
End With
i = i + 1
End If
If MyString3 > 0 And MyString3 < 9 Then
y = 0
Form1.Controls.Add "VB.Frame", "Frame" & (i)
Dim oFrame As VB.Frame
Set oFrame = Form1.Controls("Frame" & (i))
With oFrame
.BorderStyle = 0
.Height = 500
.Width = 6000
.Left = 100
.Visible = True
.Top = var_num2
End With
Do While y < 5
Form1.Controls.Add "VB.OptionButton", "Option" & (d) & (y), oFrame
ReDim ctl(1 To d, 0 To 4) As Control
Set ctl(d, y) = Form1.Controls("Option" & (d) & (y))
With ctl(d, y)
.Caption = "" & (y)
.FontSize = 12
.Visible = True
.Left = var_num3
.Top = var_num4 + 130
bouton = var_num4 + 130
.Width = 750
.Height = 300
.Alignment = oPicture
End With
y = y + 1
Z = Z + 1
var_num3 = var_num3 + 1100
Loop
d = d + 1
End If
var_num1 = var_num1 + 800
var_num2 = var_num2 + 800
Loop
Close #1
Command1.Enabled = False
End Sub
Private Sub Command2_Click()
Dim inI As Integer
Dim inJ As Integer
Dim BoolOption() As Boolean
Dim AnswerVal() As Integer
Dim BoolProceed As Boolean
ReDim BoolOption(1 To d)
ReDim AnswerVal(1 To d)
For inI = 1 To d - 1 ' Checking all questions
For inJ = 0 To 4 ' Checking all answers
OptionName = "Option" & CStr(inI) & CStr(inJ) 'OptionName
Set ctl(inI, inJ) = Form1.Controls("Option" & (inI) & (inJ))
If ctl(inI, inJ) = True Then
' if an answer is selected, then it does this
AnswerVal(inI) = inJ
BoolOption(inI) = True
End If
Next inJ
Next inI
BoolProceed = True
For inI = 1 To d - 1
If BoolOption(inI) = False Then
BoolProceed = False
' if any question does not have one option chosen then
' it will record it as BoolProceed
End If
Next inI
If BoolProceed = True Then 'if all questions are filled
Dim Filename As String
Filename = App.Path + "\Answers.txt"
Open Filename For Output As #2
For inI = 1 To d - 1
Print #2, inI & "." & AnswerVal(inI) 'Output question.answer
Next inI ' Ex. 1.2 or 3.4
Close #2
Call MsgBox("Values have been saved to " & Filename, vbInformation)
' tells you where the file is
End If
End Sub
Dim ctl() As Control
Dim d As Integer
Private Sub Command1_Click()
Filename = App.Path + "\Text.txt"
Open Filename For Input As #1
d = 1
Do While Not EOF(1)
var_num3 = 100
Line Input #1, MyString
Dim MyString2
Dim MyString3
MyString2 = Mid(MyString, 1, 1)
MyString3 = Mid(MyString, 3, 1)
If MyString <> "" Then
Form1.Controls.Add "VB.Label", "Label" & (i)
Dim oLabel As VB.Label
Set oLabel = Form1.Controls("Label" & CStr(i))
With oLabel
.Top = var_num1
.Visible = True
.Caption = MyString
.AutoSize = True
.BorderStyle = 1
.Left = 100
End With
i = i + 1
End If
If MyString3 > 0 And MyString3 < 9 Then
y = 0
Form1.Controls.Add "VB.Frame", "Frame" & (i)
Dim oFrame As VB.Frame
Set oFrame = Form1.Controls("Frame" & (i))
With oFrame
.BorderStyle = 0
.Height = 500
.Width = 6000
.Left = 100
.Visible = True
.Top = var_num2
End With
Do While y < 5
Form1.Controls.Add "VB.OptionButton", "Option" & (d) & (y), oFrame
ReDim ctl(1 To d, 0 To 4) As Control
Set ctl(d, y) = Form1.Controls("Option" & (d) & (y))
With ctl(d, y)
.Caption = "" & (y)
.FontSize = 12
.Visible = True
.Left = var_num3
.Top = var_num4 + 130
bouton = var_num4 + 130
.Width = 750
.Height = 300
.Alignment = oPicture
End With
y = y + 1
Z = Z + 1
var_num3 = var_num3 + 1100
Loop
d = d + 1
End If
var_num1 = var_num1 + 800
var_num2 = var_num2 + 800
Loop
Close #1
Command1.Enabled = False
End Sub
Private Sub Command2_Click()
Dim inI As Integer
Dim inJ As Integer
Dim BoolOption() As Boolean
Dim AnswerVal() As Integer
Dim BoolProceed As Boolean
ReDim BoolOption(1 To d)
ReDim AnswerVal(1 To d)
For inI = 1 To d - 1 ' Checking all questions
For inJ = 0 To 4 ' Checking all answers
OptionName = "Option" & CStr(inI) & CStr(inJ) 'OptionName
Set ctl(inI, inJ) = Form1.Controls("Option" & (inI) & (inJ))
If ctl(inI, inJ) = True Then
' if an answer is selected, then it does this
AnswerVal(inI) = inJ
BoolOption(inI) = True
End If
Next inJ
Next inI
BoolProceed = True
For inI = 1 To d - 1
If BoolOption(inI) = False Then
BoolProceed = False
' if any question does not have one option chosen then
' it will record it as BoolProceed
End If
Next inI
If BoolProceed = True Then 'if all questions are filled
Dim Filename As String
Filename = App.Path + "\Answers.txt"
Open Filename For Output As #2
For inI = 1 To d - 1
Print #2, inI & "." & AnswerVal(inI) 'Output question.answer
Next inI ' Ex. 1.2 or 3.4
Close #2
Call MsgBox("Values have been saved to " & Filename, vbInformation)
' tells you where the file is
End If
End Sub
ASKER
#3 is on your exemple it use to say
question #34 is not answered
but the thing is in my file its not the same
the questions are
2.1 Are People ...
2.2 Is Mickeal ....
4.5 HOw come ....
and so one.
but this i dont know if u can help^
what i'm gonna do is take the first 3 numbers of each and put it where its missing
but not in your last exemple there is no error ( msgbox if there missing an answer ) when there missing a #
question #34 is not answered
but the thing is in my file its not the same
the questions are
2.1 Are People ...
2.2 Is Mickeal ....
4.5 HOw come ....
and so one.
but this i dont know if u can help^
what i'm gonna do is take the first 3 numbers of each and put it where its missing
but not in your last exemple there is no error ( msgbox if there missing an answer ) when there missing a #
so what do you want it to do now? I don't really understand. Does it work now?
We'll figure this one out yet!
Jacamar.
We'll figure this one out yet!
Jacamar.
ASKER
there need to be an msgbox if there missing an answer if there missing one answer, the thing is before, it use to say all the answers missing, if there missing more then one, i just one an MsgBox saying the first question missing is.. doesent have to show ALL the quesitons missing but only the first one.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thx alot Jacamar
really appreciate
thx again
really appreciate
thx again
t'was my pleasure.....:)
Jacamar
Jacamar
Do the following:
Make all your radio buttons part of a control array. (You can set this up by copying a control and pasting it repeatedly.)
For each question, put a frame on your form. Put five of these radio buttons in each frame. This is goups the radio buttons so that only one can be active in each frame.
Then add:
Private Sub Option1_Click(Index As Integer)
Print #ff, Option1(index).Caption
End Sub
Kindest regards,
Rhaedes