Advice on filling a textbox
-
Hey guys Ive got a problem Ive got a gridview which has a textbox in one of the columns. On my OnRowDataBound event I check 7 fields in a database and then which ever ones have data in I add a letter to the textbox, for example if two fields have data in I would add A and G. The problem is at the moment I have 7 different if statements and each one adds a letter but they are overwriting the previous letter instead of adding to it, is there a way to add the letter to the textbox without overwriting the preivous. I know the whole concept im describing does sound silly but trust me it makes sense when the app runs. thanks in advance! :-D
We are not a Code Charity
-
Hey guys Ive got a problem Ive got a gridview which has a textbox in one of the columns. On my OnRowDataBound event I check 7 fields in a database and then which ever ones have data in I add a letter to the textbox, for example if two fields have data in I would add A and G. The problem is at the moment I have 7 different if statements and each one adds a letter but they are overwriting the previous letter instead of adding to it, is there a way to add the letter to the textbox without overwriting the preivous. I know the whole concept im describing does sound silly but trust me it makes sense when the app runs. thanks in advance! :-D
We are not a Code Charity
.netman wrote:
a way to add the letter to the textbox without overwriting the preivous.
Find the texbox and append the text ?
TextBox1.Text += "Your new Text"
All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia How to use google | Ask smart questions
-
.netman wrote:
a way to add the letter to the textbox without overwriting the preivous.
Find the texbox and append the text ?
TextBox1.Text += "Your new Text"
All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia How to use google | Ask smart questions
-
Hey guys Ive got a problem Ive got a gridview which has a textbox in one of the columns. On my OnRowDataBound event I check 7 fields in a database and then which ever ones have data in I add a letter to the textbox, for example if two fields have data in I would add A and G. The problem is at the moment I have 7 different if statements and each one adds a letter but they are overwriting the previous letter instead of adding to it, is there a way to add the letter to the textbox without overwriting the preivous. I know the whole concept im describing does sound silly but trust me it makes sense when the app runs. thanks in advance! :-D
We are not a Code Charity
just store the previos value in some temporary variable and set all to the text box at once. or at the time when you are setting value at the text box consider existing value also eg
text1.text += text1.text + "a"
(C# sample)