PC Review


Reply
Thread Tools Rate Thread

How to convert a text value to an integer and store this in a table using VB.NET

 
 
Dipendra Darbar via DotNetMonster.com
Guest
Posts: n/a
 
      11th Mar 2005
Hi,

I have created an AssetTracking database in SQL Server 2000 and one of my
master tables generates an autonumber for a unique PC Make. For example my
table will consist of the following:

1 HP
2 Dell
3 Fujitsu

My main table which will holds the PC Information includes a PCMakeID field
to represent the PC Make.
In VB.NET, I have added a DBCombo to populate the PC Make details. When I
press the Save button on the form to save the details to the PC Information
table, I want to save the PCMakeID value into the table instead of the
actual text value.

Does anyone know how to go about achieving this task.

Regards

Dipendra

--
Message posted via http://www.dotnetmonster.com
 
Reply With Quote
 
 
 
 
=?Utf-8?B?Q3JvdWNoaWUxOTk4?=
Guest
Posts: n/a
 
      11th Mar 2005
Can't you just use: 'CInt(TextBox1.Text)' for example?

"Dipendra Darbar via DotNetMonster.com" wrote:

> Hi,
>
> I have created an AssetTracking database in SQL Server 2000 and one of my
> master tables generates an autonumber for a unique PC Make. For example my
> table will consist of the following:
>
> 1 HP
> 2 Dell
> 3 Fujitsu
>
> My main table which will holds the PC Information includes a PCMakeID field
> to represent the PC Make.
> In VB.NET, I have added a DBCombo to populate the PC Make details. When I
> press the Save button on the form to save the details to the PC Information
> table, I want to save the PCMakeID value into the table instead of the
> actual text value.
>
> Does anyone know how to go about achieving this task.
>
> Regards
>
> Dipendra
>
> --
> Message posted via http://www.dotnetmonster.com
>

 
Reply With Quote
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      11th Mar 2005
"Dipendra Darbar via DotNetMonster.com" <(E-Mail Removed)> schrieb:
> I have created an AssetTracking database in SQL Server 2000 and one of my
> master tables generates an autonumber for a unique PC Make. For example my
> table will consist of the following:
>
> 1 HP
> 2 Dell
> 3 Fujitsu
>
> My main table which will holds the PC Information includes a PCMakeID
> field
> to represent the PC Make.
> In VB.NET, I have added a DBCombo to populate the PC Make details. When I
> press the Save button on the form to save the details to the PC
> Information
> table, I want to save the PCMakeID value into the table instead of the
> actual text value.


For a culture-sensitive conversion use 'CInt', for a converstion with
invariant culture semantics use 'Val'. Alternatively you can use
'Integer.Parse' and pass an appropriate 'CultureInfo' object to this method.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

 
Reply With Quote
 
Cor Ligthert
Guest
Posts: n/a
 
      12th Mar 2005
Dipendra,

When you use an datatable to load your object (from your database or build
by hand) than you can use the displaymember for your text and the
valuemember for your id.

When you need it you use the selectedvalue.

I hope this helps,

Cor


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Store Calculation from text box in table =?Utf-8?B?SmVubmE=?= Microsoft Access Forms 5 25th Jul 2007 07:38 AM
Convert integer to formatted text string.. Jeremy Sculler Microsoft Access 7 6th Sep 2006 12:07 PM
How to convert text field to integer in query criteria mjbruesch@triad.rr.com Microsoft Access Queries 3 24th Aug 2006 02:09 PM
Convert Text to Integer jerredjohnson Microsoft Excel Misc 4 14th Jun 2006 07:45 PM
How to store value from unbound Text box to table? Newbee Microsoft Access Forms 1 7th Feb 2004 06:28 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:20 AM.