Drstein99 Posted May 10, 2004 Posted May 10, 2004 Is there a way to bind the .text property of a textbox to a string variable instead of a column in a datasource? Quote www.DRSTEIN99.com www.RAIDGEAR.net www.THERE.com -> Tell them DrStein99 sent ya!
*Experts* Nerseus Posted May 11, 2004 *Experts* Posted May 11, 2004 No, you can't bind directly to a string variable. If you have a class with a string property, you could bind to that string. You can bind to almost anything, other than a stand-alone value-type variable (such as a string, DateTime, int, etc.). You can even bind one textbox to another with something like: textBox2.DataBindings.Add("Text", textBox1, "Text"); -Nerseus Quote "I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
Drstein99 Posted May 11, 2004 Author Posted May 11, 2004 I do have a class, and right now I was testing with binding to a string public variable. I will move it to a property and see how it whirls. Thanks for heads up. Appreciate it. Quote www.DRSTEIN99.com www.RAIDGEAR.net www.THERE.com -> Tell them DrStein99 sent ya!
Drstein99 Posted May 11, 2004 Author Posted May 11, 2004 Ok I'm getting errors. Please help. I modified the code to fit my application, and here is the code: tb1 - the textbox mformscript.massembly - is the class, its a System.Reflection.Assembly esTestString - is the property inside the class ------------------ tb1.DataBindings.Add("Text", mFormScript.mAssembly, "esTestString") ------------------- error code: Additional information: Cannot bind to property or column esTestString on DataSource. --------------- Please help. Quote www.DRSTEIN99.com www.RAIDGEAR.net www.THERE.com -> Tell them DrStein99 sent ya!
Drstein99 Posted May 11, 2004 Author Posted May 11, 2004 Whoops, the propert code inside the mAssembly class is: Public Property esTestString() As String ' 'test property setting for data capture Get Return esTest End Get Set(ByVal prmVal As String) esTest = prmVal End Set End Property Quote www.DRSTEIN99.com www.RAIDGEAR.net www.THERE.com -> Tell them DrStein99 sent ya!
Drstein99 Posted May 11, 2004 Author Posted May 11, 2004 Whoops, after a little more research I found the nature of my problem was addressing the instance instead of the assembly. Please disregard last reqest for information - problem completely resovoled with perfection! Thanks so much for the help! If I meet any of you at a MS conference, please allow me to buy you a drink of your choice, so long as you don't drink boiling platinum. Quote www.DRSTEIN99.com www.RAIDGEAR.net www.THERE.com -> Tell them DrStein99 sent ya!
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.