headkaze Posted November 24, 2006 Posted November 24, 2006 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. Quote
IUnknown Posted November 25, 2006 Posted November 25, 2006 Just remove ".ItemArray" and you should be able to enter a string the the square brackets, i.e., dataSet11.Tables["PhoneBook"].Rows[this.bindManager.Position]["Phone"] Quote
headkaze Posted November 26, 2006 Author Posted November 26, 2006 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 :) Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.