473,699 Members | 2,801 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

accessing values from hash table

6 New Member
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.ContainsK ey(textbox7.tex t))
{
////////////// blah blah blah
}

please solve this blah blah blah........... .............
Mar 5 '08 #1
2 1205
int08h
28 New Member
if (ht.ContainsKey (textBox7.Text) )
{
object[] array = (object[])ht[textBox7.Text];
textBox1.Text = (string)array[0];
//And so on
}
Mar 5 '08 #2
gurmeet07
6 New Member
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
2575
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 a little more help on one more point. This is what i've got. I have code that hunts for updated appointments in a public folder based on the order that happens to be open (code fires on an on open event) This works fine and updates my
21
3213
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 (i.e. the get_hash function) is borrowed from various snippets I found on the net. Thee free function could probably need some love. I have been thinking about having a second linked list of all entries so that the cost of freeing is in proportion to...
38
2988
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 managed to create arrays using DOUBLE data types, but when I try to access the array, the compiler complains that the number is not an INT, i.e.
21
3895
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 applies in this case though: #include <limits.h> unsigned foo(void) { static const union { unsigned char str;
11
2686
by: Douglas Dude | last post by:
how much time does it take to lok for a value - key in a hash_map ? Thanks
13
1793
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 convert these number but if B is not present the data should remain the same. my output is that all the data is converted not in the only the cases were B is present. This is the script i have
5
10213
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. This allows me to have one key with two values (one value in each dictionary). This is ugly code as the dictionaries could get out of synch (due to a bug or something). Titan
139
14171
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
792
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 form.................. if i want to access the first key , previous key , next key and last key from the hash table how to access that ?????? and then accordingly record will be displayed.................... i have tried like : ICollection key =...
0
8615
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9173
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9033
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8911
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8882
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6533
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4627
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3057
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2345
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.