Link to home
Start Free TrialLog in
Avatar of jlazanowski
jlazanowski

asked on

Should be simple



I am trying to set a variable to the value in a dataset column/row

here is the code that i have


                                                string delimStr = ",.:";
                  char [] delimiter = delimStr.ToCharArray();
                  int x = 10;
                  string locations = dsLogins1.Tables[0].Columns["locations"].ToSring();
                  string [] splitlocations = locations.Split(delimiter , x);
                  foreach (string s in splitlocations)

The locations value that is held in the table is something like 23,100,241,221

When I do a debug and view the variable value of locations, it just is a string "locations"

How do I set the value of this to the variable?

Thanks,
Justin
ASKER CERTIFIED SOLUTION
Avatar of sharpnet
sharpnet

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of sharpnet
sharpnet

oh, and don't forget the ToString() at the end of that statement.  I had removed for clarity.

Nick
Avatar of jlazanowski

ASKER

I put it on there..

One more questions semi related.

first I am using a drop down box to select a value. This dropdown is bound to the dataset (this is done in the desinger)

when the user presses a select button it binds to text boxes and a few check boxes to values in the dataset (the row the user selected)

My problem is how do I know what row the user selected, since this wasn't done in code but in the designer I am not aware of the row index.

well, the follow up question should technically be a new question in the forums since it's a different type of question.  Just fair for the points...

But, my first thoughts are that when a user selects something from the dropdown box, they are not actually selecting a "row" from the dataset.  What you'll have to do is find the selectedindex or selecteditem from the dropdown box and, via code, find the row containing that information and make changes from there.  It shouldn't matter if your dataset and dropdown are bound via code or the designer, you're still looking at "item" objects from the dropdown box.  

If you make a new post for this question and paste some of your code, I can help you more with it.

Nick
Nick,

Would you do me a favor and look at
https://www.experts-exchange.com/questions/21368848/Finding-a-row-in-a-dataset.html

I am not getting the anwser that I am looking for and I though maybe a fresh set of eyes could help.

Thanks
Yeah, I'll give it a shot.