473,625 Members | 2,687 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Concatenating Strings

4 New Member
I want to concatenate values of two text boxes into one string but these should be separated by a space in the database table. i have tried all the following but twas not successful:

Dim fullName as String
Dim Surname as String

Surname = String.Concat(t xtSurname.Text, Chr(173)) --this one is meant to append an empty string to txtSurname)

FullName = String.Concat(S urname, txtName.Text) -- now I am concatenating tha above variable and txtName.Text, it failed.

I have also tried this:
I added 1 to the length of txtSurname, whatever length, to accomadate the space when I concatenate the values of the two textboxes i have already mentioned:

Dim lenSurname as int16
Dim FullName as String

lenSurname = length(txtSurna me.Text) + 1

Surname = txtSurname.Text .Padright(lenSu rname,"")

FullName = String.Concat(S urname, txtName) - this one also does not work!

I have also tried this one:

FullName = txtSurname.Text & chr(173) & txtName.Text.

Please help.
Jul 31 '06 #1
4 1654
dotnet
22 New Member
Here is code for you

Dim Name As String
Dim Surname As String
Dim FullName As String

Name = "Nitin "
Surname = " Mittal "
If Surname.Length > 0 And Name.Length > 0 Then

FullName = Name.Trim + " " + Surname.Trim
Else
FullName = Name.Trim
End If

You sould replace my variables by your variables

Regards
Nitin
Jul 31 '06 #2
lindiwemaduna
4 New Member
Thank you Nitin, I have done exactly as you have advised but it still does not give the correct result. It does not leave the space in between the two variables.

Regards
Lindiwe
Aug 1 '06 #3
dotnet
22 New Member
Well it should work.. i hav tested it on my machine..
anyway.....can you provide your code so that I can debug it.

Regards
Aug 1 '06 #4
sasi_response
3 New Member
Use StringBuilder insted of String. You may get proper result.

--Sasidhara K Karasi
Aug 1 '06 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

1
2045
by: dont bother | last post by:
Hey, I have these attributes: index which is a numerical value value vector which is a numerical float value and I want to concatenate like this:
4
2337
by: Juan | last post by:
Does any one know if there are reported bugs when concatenating strings? When debugging each variable has the correct value but when I try to concatenate them some values are missing (I can´t see them in the debugger). After encoding the string (the sameone which complete value is not visible from the debugger) all the values can be seen but they are spaced by big amounts of zeros and use more that the 2048 bytes allocated. It is like if...
1
3673
by: ebobnar | last post by:
I need to call the function LoadImage which take a LPCTSTR argument to specify the path to the image to load. However, I need to create this path dynamically from user input by concatenating strings together. I'm using visual c++.net 2003. I've tried using the String class to put the image path together and then cast the String to a LPCTSTR, but that cast is forbidden. Since I'm using visual c++.net should I not be using functions like...
4
1789
by: FB's .NET Dev PC | last post by:
Interesting note, the code below as is will attempt to cast what is clearly indicated as a string into a double. This is becuase the use of + as a concatenation operator. The error message generated is included with the code. Use & instead and it works. Dim pstrSend As String = "" 'ActionCode 1 and 2 are type BYTE, Msg is a byVal string parameter
6
2056
by: Hennie7863 | last post by:
Hi, I have table which has the following values : ID SEQ Text 1 1 A 2 1 B 3 2 C 4 2 D 5 2 E
21
2305
by: c | last post by:
Hi everybody. I'm working on converting a program wriiten on perl to C, and facing a problem with concatenate strings. Now here is a small program that descripe the problem, if you help me to solve in this small code, I can solve it on my own program...you don't want to have head-ache :-) So, the problem excatly is, I built an array..just like this one.
10
3475
by: Neil | last post by:
Using the MS Rich Textbox Control 6.0 in Access 2000, I need to concatenate several RTB controls into a single RTF file. Sometimes two strings will be side-by-side; other times they need to be separated by a hard return. For example, say I have the following 4 RTB controls in my form: RTB1 = "abcd" RTB2 = "efgh" RTB3 = "ijkl" RTB4 = "mnop"
3
2304
by: Big Brother | last post by:
I've been thinking about the seemingly simple task of writing a va_arg-type function to concatenate arbitarily many strings. My first thoughts violated the following principles: 1) never calculate the length of a string more than once; 2) never invoke realloc() multiple times if you can make do with a single malloc(). As a result, I came up with the code below. This avoids the two pitfalls above, but at the expense of needing three...
4
2832
by: clinisbut | last post by:
I'm not sure if this is the right group, but I didn't found any other more appropiate to post my problem. I'm trying to concatenate chars using the Glib library and I'm getting strange behaviours. This is my code: int num_chars = strlen( text ); vector< gchar* sourceStrings;
0
8251
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8182
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8352
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8494
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7178
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5570
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4085
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2614
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1496
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.