[Resolved] String As Variable
Lets say I have a string that contains label.Caption. The variable name is Send (Not the useage but similar structure)
I want to know how would I get it to show frmHello.Show instead of Send on Runtime.
I want it to show
label.Caption = Value
instead of
Send = Value
It seems so simple! Do I need to declare an object. If so How. I'm still learning the object useage. The book isn't being very nice w/ me right now.
Re: [Resolved] String As Variable
Ok,
Try:
VB Code:
Option Explicit
Private Sub Form_Load()
Call PassBack(ImaTextbox, "This is a Test")
End Sub
Public Sub PassBack(ByRef Send As TextBox, ByVal strValue As String)
Send = strValue
End Sub
I changed the Function to a Sub (as noting (in this case) was being passed back)
Re: [Resolved] String As Variable
The appending a number is not the solution here (I dont beleive) - that was just an example if you did know just the name of the control. I think the solution is to pass the
control (see Sub in previous post).
Bruce.
Re: [Resolved] String As Variable
Read My mind, I was looking for some code to help me. I wasn't fully sure what you wanted, but before I posted ran a quick google and nothing showed up! Thanks again!
Re: [Resolved] String As Variable
I'm pulling the text from a var label.caption but it won't work.
This is because it is not a valid textbox item. However the text contained within that is the key. How do I break the variable and show only the text. I keep getting this text mismatch error. And have it narrowed it down to that issue.
Re: [Resolved] String As Variable
Post your code. I don't understand what the label has to do with the textbox.
Re: [Resolved] String As Variable
Does 'Label3.Caption' identify a Control? ie Text1?
Re: [Resolved] String As Variable
If so, then I succsefully tested this:
VB Code:
Option Explicit
Private Sub Submit_Click()
Call TextBack([b](Me.Controls(Label1.Caption)[/b], txtMil.Text)
End Sub
Public Sub TextBack(ByRef Send As TextBox, ByVal strValue As String)
Send = strValue
End Sub
In this case, my Labe1's Caption = "Text1".
Note: I used a TextBox.... (cant load MaskedEditBox on this PC)
Bruce.
Re: [Resolved] String As Variable
Ahha, little modifying of the code and it works. Thanks again!