Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I am writing a simple PhoneBook database program, and part of it requires me to get the values of the currently viewed record.

 

I am using BindingManagerBase to handle browsing through the Phone Book.

 

Right now I am using the following line to get the value of column 0 ("Phone") to retrieve the phone number of the currently viewed record.

 

dataSet11.Tables["PhoneBook"].Rows[this.bindManager.Position].ItemArray[0]

 

I am wondering, can I possibly get the value like ItemArray[] but using the column's name. The above line gives me the value of "Phone". But I would like to use the columns name "Phone". Eg. ItemArray["Phone"], but obviously that only accepts a int index value. I can't seem to find a simple way to do it.

Posted
Just remove ".ItemArray" and you should be able to enter a string the the square brackets' date=' i.e.,
dataSet11.Tables["PhoneBook"].Rows[this.bindManager.Position]["Phone"]

[/quote']

 

Thanks it works well :)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...