Click here to Skip to main content
15,943,008 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi, I am making an inventory system.
As for my adding products :
I creat 3 textbox (for the description product only)
3 textbox cotains: Product Name, Dimension & Others. This 3 textbox will entry to a description row as one, and now I want to do an Update of the product (passing variable) into textboxes. My question is How can I split my description entry to pass the varible into 3 textboxes.

Model | Brand | Descripion
TCS-21 | Monster | Handlebar 2x2x2 inc StainlessSteel

I want the description row to pass the variable to show the data in the 3 textboes..

TextBox1(Name) = Handlebar
TextBox2(Dimension) = 2x2x2 inc
TextBox3(Others) = StainlessSteel

Thank you.

What I have tried:

As of now, I did nothing coz I don't know how to start.
Updated 8-Aug-18 0:26am
Bryian Tan 5-Aug-18 0:55am    
By looking at the provided example. It might not be possible because the description doesn't seem like to have a fixed deliminator that the code can use to split the string.
Doug- VisualBasic VB.NET 7-Aug-18 1:51am    
In your description field, while you have many spaces, are you positional locations the same? The number of spaces between each of the primary pieces of information?
first space end of Name? 3rd space end of Dimension? Other after that ?
What is the same about every Description field? Anything? Find the commons and find your solution.

what if I have this sir? Handle bar 2x2x2 inc steel type;

then It will display on textbox as
TextBox1 = Handle bar;
TextBox2 = 2x2x2 inc;
textbox3 = steel type;

Is this possible or do I need to put some special char to split the sentence?

Thank you.
Share this answer
Based on what posted here. Let assumed you can modify the code to save the description to include a deliminator. Example "Handlebar|2x2x2 inc|StainlessSteel". Then you can modify the code to do something like
string description= "Handlebar|2x2x2 inc|StainlessSteel";
string[] descriptions= description.Split('|');

//assuming position 0 is for textbox1, 1=textbox2, 2=textbox3

TextBox1(Name) = descriptions[0];
TextBox2(Dimension) = descriptions[1];
TextBox3(Others) = descriptions[2];

Share this answer
To.Taleclipse 5-Aug-18 7:09am    
Thank you for your comment, Oh yeah I already did the splitter as Special characters, but I don't want to show it on the database ("|" any special characters). I was planning to split it as (" ") but the entry have lots of spaces like: ( "This is the test for now blah blah blah").

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900