By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,446 Members | 3,031 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,446 IT Pros & Developers. It's quick & easy.

to call a custom dialogbox

100+
P: 142
Please help.
I created a custom dialogbox name "DialogBox". What i want is input values to the dialogbox, and those values appear on a textbox in Visio. After i creat the textbox and the dialogbox, I used "DialogBox.show", so i can enter values, and I use "ashape as shape", "ashape.Text=userinput", then how should i defind "userinput"?

Thanks
Feb 20 '07 #1
Share this Question
Share on Google+
9 Replies


Expert 5K+
P: 8,434
Please help.
I created a custom dialogbox name "DialogBox". What i want is input values to the dialogbox, and those values appear on a textbox in Visio. After i creat the textbox and the dialogbox, I used "DialogBox.show", so i can enter values, and I use "ashape as shape", "ashape.Text=userinput", then how should i defind "userinput"?
Can we clarify the programming environment in which you are working? Is this VB6? VB.Net? VBA or similar language built into Visio?

If VB6, I'd suggest that a textbox on the "dialogbox" window would be the way to go.
Feb 20 '07 #2

100+
P: 142
could you specify a little more.
I am using VB6. What i try to do is call the "dialogbox" in the textbox's code. Is there a function "ashape.Text=Dialogbox(xx)"? what should be the "xx" if i want all the input and label show up on the textbox.
Thanks


Can we clarify the programming environment in which you are working? Is this VB6? VB.Net? VBA or similar language built into Visio?

If VB6, I'd suggest that a textbox on the "dialogbox" window would be the way to go.
Feb 20 '07 #3

Expert 5K+
P: 8,434
could you specify a little more.
I am using VB6. What i try to do is call the "dialogbox" in the textbox's code. Is there a function "ashape.Text=Dialogbox(xx)"? what should be the "xx" if i want all the input and label show up on the textbox.
From the sound of it, what you ought to do is write a Public Function which shows your dialogue box form (use vbModal on the Show), waits for it to be hidden (by the OK button or whatever on the form), reads the value of the text box on the form, then returns it as the value of the function. So, assuming you have created your form called DialogBox with a text box on it, you could do something like this in a code module...
Expand|Select|Wrap|Line Numbers
  1. ' On your DialogBox form, when the Ok or Cancel button is clicked,
  2. ' copy the button caption into the following global variable then
  3. ' hide the window.
  4. Public ButtonClicked As String
  5.  
  6. Public Function UserResponse() As String
  7.   DialogBox.Show vbModal
  8.   ' Note, because it's a "modal" window, control does not return
  9.   ' here until it is hidden or closed.
  10.   If ButtonClicked = "Ok" then
  11.     UserResponse = DialogBox.Text1.Text
  12.   End If
  13. End Function
Then in your code when you want to retrieve user input into your shape caption, just do something like...
Expand|Select|Wrap|Line Numbers
  1. aShape.Caption = UserResponse()
Feb 20 '07 #4

100+
P: 142
"aShape.Caption = UserResponse()" is what i try to figure out. It come out error message "Compile error: Expected array". Do i need to put something in ( )?

Thanks a again.


From the sound of it, what you ought to do is write a Public Function which shows your dialogue box form (use vbModal on the Show), waits for it to be hidden (by the OK button or whatever on the form), reads the value of the text box on the form, then returns it as the value of the function. So, assuming you have created your form called DialogBox with a text box on it, you could do something like this in a code module...
Expand|Select|Wrap|Line Numbers
  1. ' On your DialogBox form, when the Ok or Cancel button is clicked,
  2. ' copy the button caption into the following global variable then
  3. ' hide the window.
  4. Public ButtonClicked As String
  5.  
  6. Public Function UserResponse() As String
  7.   DialogBox.Show vbModal
  8.   ' Note, because it's a "modal" window, control does not return
  9.   ' here until it is hidden or closed.
  10.   If ButtonClicked = "Ok" then
  11.     UserResponse = DialogBox.Text1.Text
  12.   End If
  13. End Function
Then in your code when you want to retrieve user input into your shape caption, just do something like...
Expand|Select|Wrap|Line Numbers
  1. aShape.Caption = UserResponse()
Feb 22 '07 #5

Expert 5K+
P: 8,434
"aShape.Caption = UserResponse()" is what i try to figure out. It come out error message "Compile error: Expected array". Do i need to put something in ( )?
You could try it without the parentheses.

UserResponse() is the name of the function I described in my earlier message. For this to work it must be accessible. If it's in a code module (not a form) and defined as Public, this should work.

Unless aShape is an array perhaps - is this the case?

Oh! One other question. How come your shape control has a Caption property? Mine doesn't.
Feb 22 '07 #6

100+
P: 142
Oh, yeah, i am uing .text, not .caption.

one more question, can u tell me how to conbain "Sub... End Sub" and "Function...End Function"?

Thanks


You could try it without the parentheses.

UserResponse() is the name of the function I described in my earlier message. For this to work it must be accessible. If it's in a code module (not a form) and defined as Public, this should work.

Unless aShape is an array perhaps - is this the case?

Oh! One other question. How come your shape control has a Caption property? Mine doesn't.
Feb 23 '07 #7

Expert 5K+
P: 8,434
Oh, yeah, i am uing .text, not .caption.

one more question, can u tell me how to conbain "Sub... End Sub" and "Function...End Function"?
Sorry, I don't understand the question. Could you rephrase it?
Feb 24 '07 #8

100+
P: 142
Thanks, I got previous part work.
Can you help me on two other questions:
1) I show the custom dialogbox use the while loop, and there is a combobox in that dialogbox. I need use the last selected value in the drop down manu over and over again, but every time when loop back, the last selected value disppear. How to make the last selected value appear?

2) In that dialogbox have "OK" and "Cancle" bottom, I try use the follow code inside the while loop to stop showing the dialogbox, but it didn't work. Can you tell me how to defined the "cancel"?

"If Cancel = True Then
Unload DialogBox
End If"


thanks again.

Sorry, I don't understand the question. Could you rephrase it?
Feb 27 '07 #9

100+
P: 142
never mind, i got it.

Thanks, I got previous part work.
Can you help me on two other questions:
1) I show the custom dialogbox use the while loop, and there is a combobox in that dialogbox. I need use the last selected value in the drop down manu over and over again, but every time when loop back, the last selected value disppear. How to make the last selected value appear?

2) In that dialogbox have "OK" and "Cancle" bottom, I try use the follow code inside the while loop to stop showing the dialogbox, but it didn't work. Can you tell me how to defined the "cancel"?

"If Cancel = True Then
Unload DialogBox
End If"


thanks again.
Feb 28 '07 #10

Post your reply

Sign in to post your reply or Sign up for a free account.