Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help required creating a dialog box

Status
Not open for further replies.

smiler44

Technical User
Sep 18, 2009
83
0
0
GB
I have some code that builds a dialog box with two options the user can choose. I donot know in advance how many options the user will require and so I am going to cater for up to 20 options.
I want to modify this code that creates a predefined number of options the user can choose.
I want to create the options depending if variables get populated.

begin dialog userdialog1 183, 75, “choose”
groupbox 5, 4, 97, 47 “”
optiongroup .optiongroup1
optionbutton 16, 12, 46, 12, “findt”
optionbutton 16, 30, 67, 8, “delete”
okbutton 125, 6, 54, 14
cancelbutton 125, 26, 54, 14
end dialog

dim mydialog as userdialog1
on error resumenext
dialog mydialog1
if err=102 then
msbox “ marco has hit a problem and has exited”
end if
bla
bla
bla
end sub


I was thinking of something like this below. The first option will always be created, the second would only be created if the variable gets populated. I will have 20 different variables and for each one that gets populated I want to create and option
Dim myvariable as string
begin dialog userdialog1 183, 75, “choose”
groupbox 5, 4, 97, 47 “”
optiongroup .optiongroup1
optionbutton 16, 12, 46, 12, “findt”
if myvariable = “found” then
optionbutton 16, 30, 67, 8, “delete”
end if
okbutton 125, 6, 54, 14
cancelbutton 125, 26, 54, 14
end dialog

Attachamate does not seem to like the IF/End if
at least not the way I have done it, is there a way to do this?

thank you smiler44
 
thank you remy998, i tried the code via the link but it failed. Managed to sort one problem but the others have me beat. the code failed on all of these lines:
Begin Dialog ThatDlg 50, 50, "DlgBox", .ThatFileDlgFunc
DropListBox 5, 5, 40, 42, List1(), .Drop1
For i = 0 to 6
For j = 0 to 9
MsgBox str(j) & "," & str(i) & " = " & AllTheInfo(j,i)
Next
Next

i tried declaring I and J as strings but that did not work. if i dont declare them as strings then the code just fails on


Begin Dialog ThatDlg 50, 50, "DlgBox", .ThatFileDlgFunc
DropListBox 5, 5, 40, 42, List1(), .Drop1
MsgBox str(j) & "," & str(i) & " = " & AllTheInfo(j,i)



would apprecitae further advice. :)

thank you smiler44
 
a few more hours work and i have moved on. not sure what the problems were but changing some letters from lower case to upper case and removing spaces in sentances of the code seems to have cured them. i have not had chance to run the code to test it but it does at leaset compile. also found that altough this does not work:
if whatever then
bla
bla
end if

this does work

if whatever then
bla
bla
Elseif what ever then
bla
bla

end if


thank you remy998 for all your help

smiler44


 
still not sure what you are trying to accomplish.

if you want to use an opening dialog box to generate additional dialog boxes based on a variable, then it would make sense to create different subs for each of the dialog boxes that is required.
 
Sorry I have been away for a few days.

I may be asking the wrong question and using the term dialog box incorrectly. I want to create a "screen/page" that has upto 20 option buttons, in fact I think they are also known as radio buttons that the user can select, one at a time. An option/radio button is only built if variable1, variable2 strings etc are populated.

smiler44
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top