473,396 Members | 1,966 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

accessing values from hash table

hey guys i m new to .net and facing one problem

on click of a button (saving the data to the hash table)
like this :

there are 7 textboxes and first textbox1.text is the key for hash table n all other textbox.text are values which are stored in an object type array...........

object[] obj = { textBox2.Text, textBox3.Text, textBox4.Text, textBox5.Text, textBox6.Text };

ht.Add(textBox1.Text,obj);

after save ---- all textboxes.text is set to blank so that user can either enter next values or can find out information of another paricular record..........(function like find or search a record)

now on click of another button i want to access values from hash table..............
which are to be displayed in the 7 textboxes ............ on the same form
(this is the function of searching a record and displaying its content)

i was using like : if(ht.ContainsKey(textbox7.text))
{
////////////// blah blah blah
}

please solve this blah blah blah........................
Mar 5 '08 #1
2 1189
int08h
28
if (ht.ContainsKey(textBox7.Text))
{
object[] array = (object[])ht[textBox7.Text];
textBox1.Text = (string)array[0];
//And so on
}
Mar 5 '08 #2
hey thnx for that

now is there any way by which i can loop on textboxes n in just two lines my work culd be possible instead of assigning values one by one to each textbox..................i hope u got it wat i m asking???

I mean smthing like

int j=0;

for(int i = 1; i <= (number of textboxes) ; i++)
{
textbox[i].text=array[j++];
}
Mar 5 '08 #3

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

Similar topics

7
by: Dave Hopper | last post by:
Hi I posted a question recently regarding problems I am having getting a value from a list box to use in a query. I got a lot of help, for which I thank you and it's nearly working! But I need...
21
by: Johan Tibell | last post by:
I would be grateful if someone had a minute or two to review my hash table implementation. It's not yet commented but hopefully it's short and idiomatic enough to be readable. Some of the code...
38
by: djhulme | last post by:
Hi, I'm using GCC. Please could you tell me, what is the maximum number of array elements that I can create in C, i.e. char* anArray = (char*) calloc( ??MAX?? , sizeof(char) ) ; I've...
21
by: Hallvard B Furuseth | last post by:
Is the code below valid? Generally a value must be accessed through the same type it was stored as, but there is an exception for data stored through a character type. I'm not sure if that...
11
by: Douglas Dude | last post by:
how much time does it take to lok for a value - key in a hash_map ? Thanks
13
by: Iris83 | last post by:
Hi, I have a question about converting some of the data in my dataset but leave some data the way it is. I have a hash and if the key is present and the Value of the Hash equals B it should...
5
by: titan.nyquist | last post by:
Is there a typical way to create a dictionary (or hash table) with two values, instead of one? Currently, my data structure is TWO dictionaries, each with matching and fully sychronized keys. ...
139
by: ravi | last post by:
Hi can anybody tell me that which ds will be best suited to implement a hash table in C/C++ thanx. in advanced
0
by: gurmeet07 | last post by:
hi guys if i m navigating among the records saved in hash table...........i.e. first record , previous record , next record and last record as navigating buttons can be there on a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.