🔒 Locked
visual basic
Advertisement
Original Post
this topic fits here better
ButtonConst = cboType(0) + cboType(1) + cboType(2)
x = MsgBox("Prompt", ButtonConst, "Title")
lets say i have vbokonly stored in cbotype0, vbquestion stored in 1 and vbdefaultbutton2 stored in 2, and i want to add them up and put it into buttonconst, and later display through msgbox, but that code doesnt work, how can i fix it, so the code funtions, and it will display the msgbox with default 2 button question with okonly msgbox
if u can help, it is greatly appreciated
A couple of things:
1) If your message box is vbOKOnly, you only have one button, so the default button will not be the second button. The vbDefaultButton2 constant does not make it a two-button dialog, it tells it which button should be the default selection if the user hits Enter. Adding the vbDefaultButton2 flag doesn''t mean anything.
2) Are you storing the actual values of vbOKOnly, vbQuestion and vbDefaultButton2 in the combo box somewhere?
3) Ideally, you should be "Or"ing those flags together, not adding them.
RomSteady - I play games for a living.
1) If your message box is vbOKOnly, you only have one button, so the default button will not be the second button. The vbDefaultButton2 constant does not make it a two-button dialog, it tells it which button should be the default selection if the user hits Enter. Adding the vbDefaultButton2 flag doesn''t mean anything.
2) Are you storing the actual values of vbOKOnly, vbQuestion and vbDefaultButton2 in the combo box somewhere?
3) Ideally, you should be "Or"ing those flags together, not adding them.
RomSteady - I play games for a living.
well, i have 3 combo box, the first one store stuff like vbcancel, vbyesno, second one stores question,, vbcritical, third one stores vbdefaultbutton4 and stuff, if i do
x = ("agsd", vbYesNo+vbCritical, "dgd") it works, just now i want to add all 3 to buttonconst, so i just have huttonconst to display the msgbox
x = ("agsd", vbYesNo+vbCritical, "dgd") it works, just now i want to add all 3 to buttonconst, so i just have huttonconst to display the msgbox
Have you even defined your variables.
ButtonConst = cboType(0) Or cboType(1) Or cboType(2)
x = MsgBox("Prompt", ButtonConst, "Title")
this code still doesnt work, it says type mismatch, besides that, if the first line of code worked, i dont think that second line will work, if i assigned all that types of msgbox to buttonconst, and want it to show it, will it work? how do i make it work
x = MsgBox("Prompt", ButtonConst, "Title")
this code still doesnt work, it says type mismatch, besides that, if the first line of code worked, i dont think that second line will work, if i assigned all that types of msgbox to buttonconst, and want it to show it, will it work? how do i make it work
Try
ButtonConst = CLng(cboType(0)) Or CLng(cboType(1)) Or CLng(cboType(2)).
EDIT: I just realized you're probably trying to use the combobox' text as the actual bitmasks. It won't work that way.
For example, vbYesNo actually is a constant number, and you can't just use the string "vbYesNo" in it's place.
[edited by - Nik02 on October 19, 2003 11:45:36 AM]
ButtonConst = CLng(cboType(0)) Or CLng(cboType(1)) Or CLng(cboType(2)).
EDIT: I just realized you're probably trying to use the combobox' text as the actual bitmasks. It won't work that way.
For example, vbYesNo actually is a constant number, and you can't just use the string "vbYesNo" in it's place.
[edited by - Nik02 on October 19, 2003 11:45:36 AM]
Use Select Case to solve this problem.
[edited by - Nik02 on October 19, 2003 11:55:21 AM]
Dim cbo0flag as long 'other flag variables should also be declared.
Select Case cboType(0)
Case "vbYesNo": cbo0flag = vbYesNo
Case "whatever": cbo0flag = vbWhatEver
End Select
'repeat the select with each combobox.
MsgBox("test", cbo0flag Or cbo1flag Or cbo2flag, "title")
[edited by - Nik02 on October 19, 2003 11:55:21 AM]
oh, so u cant use the text in the combo box u select, but how would i make it so, that people select what they want in the combo boxes, and when i click a button, it shows them the msgbox, and what u mean by using select case, i''m not so sure on how to do that, thx for helping
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement