ps1terry

ok

i want to write a small program to where if the user enters

1234 then it will show in another text box car

i am good with math programs but since this is actualluy going to do a search i will have probably 500 different number letter combinations and i am going to want it to match exactly and show the product. any help with this will be greatful...




Re: Visual Basic Express Edition help with small program ...

Adamus Turner

Are you going to hard code into the application or is a database available

Adamus






Re: Visual Basic Express Edition help with small program ...

ps1terry

i am going to hardcode everything into it...




Re: Visual Basic Express Edition help with small program ...

gibbo1715

Personally I dont think hard coding this is the way to go

you would be far better off with a database if that is possible,

if not there are a number of ways to do what your after, heres a couple of basic examples, this can be called from a button or lost focus event etc......

Code Snippet

Select Case Me.Textbox1.text

Case "1234"

Me.textbox2.Text = "Car"

Case "4321"

Me.Textbox2.Text = "Motorbike"

End Select

Code Snippet

If Me.Textbox1.Text = "1234" then

Me.textbox2.Text = "Car"

Else if Me.Textbox1.Text = "4321" then

Me.textbox2.Text = "Motorbike"

End If

You might also want to consider a dropdownbox to keep your list in, that way the user can only add what you want them to






Re: Visual Basic Express Edition help with small program ...

bruno_1

Just use Dictionary (or hashtable) class, they are done for cases like yours. they do the work of searching for you(and they even do verification if there is no duplication), more than this, they're implemented in an efficient way (try to put some 100000 and do a search and you see what i mean).
if you want to do this in your way, without hashtable and their fast search, then it is simple, just make 2 arrays with 500 elemenets each, like
int numbers[] = new int[500];
string[] products = new string[500];

then when you're adding elements, you add like (for an arbitrary index)
numbers[index] = 1234;
products[index] = Car;

then when you want to search for the 1234 later, you do a some linear search(or any) through all the numbers, and you get your index, then you use it to get the equivalent product = products[index].
for 500 it is not big deal, so you probably need to use the 2 way.

Hope this helped





Re: Visual Basic Express Edition help with small program ...

ps1terry

Thanks i really appreciate all the help...




Re: Visual Basic Express Edition help with small program ...

Duane in Japan

Microsoft is giving away (online) Visual Studio 2005 Express and SQL Server Database software for free, with just one training video series you can do what you are talking about very easily, I have only been into it for a couple of months. I tried VB6 about 5 years ago unsuccessfully, but this new stuff does the coding for you and there are hundreds of video tutorials. You can turn your project into a website just like you see in your favorites collection.

Cant beat free software from MS, that is what happens when your rich I guess.........





Re: Visual Basic Express Edition help with small program ...

oscarjaime

Hello Duane

You have good point there about the free VB 2005 Express and the SQL - but please tell me something

When I'd download the VB 2005 Express I notice on the Add New Item - that SQL Server Database is not there

all I see is the - DataSet - LINQ to SQL Classes - Local DataBase and Service-based Database, These are all the same

or I have to download SQL Server Database separately

Is any web site that you recommend to learn the SQL Server Database

Thanks

oscar






Re: Visual Basic Express Edition help with small program ...

Duane in Japan


VS SQL Numeric Storage TechNet Webcast: Introducing a New Storage Format for Decimal and Numeric Data in SQL Server 2005 (Level 200)
TechNet Webcast: Introducing a New Storage Format for Decimal and Numeric Data in SQL Server 2005 (Level 200)
VS SQL Pt 1 ~ 13 Visual Studio 2005: Video Series: SQL Server 2005 Express Edition for Beginners
Visual Studio 2005:
VS SQL Server Webcasts
VS SQL Web App Pt1
MSDN Webcast: Building Data-Driven Web Applications with SQL Server Express (Part 1 of 3) (Level 200)
VS SQL Web App Pt2
MSDN Webcast: Building Data-Driven Web Applications with SQL Server Express (Part 2 of 3) (Level 300)
Lookup Webcasts for SQL and ADO.Net also, tons of stuff, SQL has its own Express Edition, yes a seperate download.