473,396 Members | 1,886 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

String.Concat(?, ?) Help please.

Ok,
I have a webform that has these checkboxes:

1. something
2. something else
3. and something else

When the user clicks on the checkbox, I want all of the selections to go
into a textbox if all are checked. But currently, just the last
selection is going in. Here's the code I have:

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button4.Click
If CheckBox1.Checked = True Then
TextBox6.Text = String.Concat(SPString, SPString1)
End If
If CheckBox2.Checked = True Then
TextBox6.Text = String.Concat(SPString, SPString2)
End If
If CheckBox3.Checked = True Then
TextBox6.Text = String.Concat(SPString, SPString3)
End If
End Sub

Any help is appreciated.
Thanks,
Trint
.Net programmer
tr********@hotmail.com

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 20 '05 #1
1 1905
Trint,
Have you tried something like:

TextBox6.Text = SPString
If CheckBox1.Checked = True Then
TextBox6.Text = String.Concat(TextBox6.Text, SPString1)
End If
If CheckBox2.Checked = True Then
TextBox6.Text = String.Concat(TextBox6.Text, SPString2)
End If
If CheckBox3.Checked = True Then
TextBox6.Text = String.Concat(TextBox6.Text, SPString3)
End If
Depending on what SPString really is, you may need it with each
String.Concat.

Also I find it "cleaner" to use the concatenation operator "&" instead of
String.Concat. Remember the concatenation operator uses String.Concat
internally so there is no performance gain or loss to use &.

Plus in this case I would consider using concatenation assignment "&="
instead of just &.

TextBox6.Text = SPString
If CheckBox1.Checked = True Then
TextBox6.Text &= SPString1
End If
If CheckBox2.Checked = True Then
TextBox6.Text &= SPString2
End If
If CheckBox3.Checked = True Then
TextBox6.Text &= SPString3
End If
Note these two lines are the same:

TextBox6.Text = TextBox6.Text & SPString1

TextBox6.Text &= SPString1

Hope this helps
Jay
"Trint Smith" <tr********@hotmail.com> wrote in message
news:eG*************@TK2MSFTNGP12.phx.gbl... Ok,
I have a webform that has these checkboxes:

1. something
2. something else
3. and something else

When the user clicks on the checkbox, I want all of the selections to go
into a textbox if all are checked. But currently, just the last
selection is going in. Here's the code I have:

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button4.Click
If CheckBox1.Checked = True Then
TextBox6.Text = String.Concat(SPString, SPString1)
End If
If CheckBox2.Checked = True Then
TextBox6.Text = String.Concat(SPString, SPString2)
End If
If CheckBox3.Checked = True Then
TextBox6.Text = String.Concat(SPString, SPString3)
End If
End Sub

Any help is appreciated.
Thanks,
Trint
Net programmer
tr********@hotmail.com

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Jesse | last post by:
I have a string with the following information. $myString = "This is my example string please. Please visit http://www.mylink.com . More example text goes here. another link http://www.link2.com...
7
by: Eddy Soeparmin | last post by:
Hi, I need to display a DateTime field in 'mm/dd/yyyy' in a DataGrid.. On myGrid1 - Properties - Columns - myColumn1 - Text format string: I tried to put 'mm/dd/yyyy' in there and it displays...
1
by: David Tomlinson | last post by:
I'm creating a HTML email using VB Script in asp.net. I am an amatuer programmer and require help with placing a string within a string: I would like my mail to generate a link to a specified...
2
by: Raghu Raman | last post by:
Hi, * I used sql server7.0 with sqlserver authentcation.Now we are migrated to sqlserver2000. We are using windows2000. we go into the sqlserver2000 by windows authentication. I tried to...
2
by: Trint Smith | last post by:
Ok, My program has been formating .txt files for input into sql server and ran into a problem...the .txt is an export from an accounting package and is only supposed to contain comas (,) between...
6
by: LCD | last post by:
This a rather simple question for all you studs out there! Please help me with this. I have a string = "Please help me", and I want to convert this into it's hex equivalent. How do I do it, I...
2
by: almurph | last post by:
Hi everyone, Hope that you can help me please? I have a string of the form: wordA wordB wordC wordD etc etc I want to de-duplicate it- that is, I want to remeove any repeated term...
10
by: ruffiano | last post by:
Does the string class have a method for retrieving the address of a string? Thanks.
6
by: djm | last post by:
hello everyone, im doing a c++ coursework which consists linked lists and use of classes. but im getting some compilation errors. can some please help me out. //this is the header file...
15
by: rajash | last post by:
Thanks for the additional comments. Here is a solution to an exercise I had problems with. I still don't think it's really what's wanted as it uses a "state variable" n - but I can't see how to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.