×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Help required creating a dialog box

Help required creating a dialog box

Help required creating a dialog box

(OP)
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

RE: Help required creating a dialog box

(OP)
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

RE: Help required creating a dialog box

(OP)
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


RE: Help required creating a dialog box

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.

RE: Help required creating a dialog box

(OP)
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

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close