Hey! what were you waiting for... ;)
After a little more thinking that's what id did, i've put all my query results into a Hashtable (the key being the name of the table) and it works.
a little bit like this:
this.Databindings.Add( this.BindProperty, myHashtable[this.BindTable], this.BindTo );
thanks.
>Stephane,
>
>What I would do in this situation is to have your BindTable property actually *be* a DataTable, not a string.
>
>~~Bonnie
>
>
>
>>Thanks Cetin,
>>
>>It does look like a set method but it's not, here's what i'm trying to do: all my controls have 3 custom properties for databinding:
>>
>>//Lets say we are in a textBox
>>this.BindTo = "Name"; // the field name to bind to
>>this.BindTable = "Table1"; // the table to bind to
>>this.BindProperty = "Text"; // The property of this control to bind
>>this.SetBinding()
>>
>>private void SetBinding()
>>{
>> this.Databinding.Add( this.BindProperty, this.BindTable, this.BindTo );
>>}
>>
>>
>>the problem i have is to pass the object from "this.BindTable" to the DataBinding.Add method.
>>
>>
>>>>In this code:
>>>>
>>>>
>>>>class TestClass
>>>>{
>>>> private string _myString = "hello";
>>>>
>>>> public TestClass()
>>>> {
>>>> this.ChangeString( "_myString", "SomeNewValue" );
>>>> }
>>>> public void ChangeString( string fldname, string newValue )
>>>> {
>>>> // refer to the field fldname and change it's value to newValue
>>>> ??????
>>>> }
>>>>}
>>>>
>>>>
>>>>How can i refer to the myString field and change it's value from it's name ?
>>>
>>>Stephane,
>>>You're somewhat describing a Property set method. Thinking you need for a special purpose cehck System.Reflection class. I believe what you need is FieldInfo:
>>>
>>>System.Reflection.FieldInfo[] fi = this.GetType().GetFields();
>>>
>>>Cetin