View Single Post
Old 06-30-08, 08:27 PM   #4
jcrox
Mahna Mahna
 
jcrox's Avatar
 
Join Date: Jul 2006
Location: Madison, Wi
Posts: 6,134
Default Re: A bit of help needed to make a simple program

Not knowing your level of knowledge in regards to Visual Studio I'll try and explain it as simply as possible..... I'm not trying to insult you, I just don't want to assume you know something so bear with me.

Start Visual Studio
File -> New Project

In the next screen enter your project's name in the text box on the bottom, select Windows Application and click next.

From the toolbox drag and drop 2 text boxes and a combo-box into the GUI

Click on the combo-box and then in the properties window(usually on the bottom right) enter a "name" property for the combo-box (cmbChoices). Repeat with each text box (txtStart, txtFinish). Set the Read Only property of txtFinish to true.

Select the combo-box again and in the properties window enter the values you want in the drop down list in the "Items" property (should say "Collection") next to it.

Double click on the combo-box, this will take you to the code behind screen and create an event handler for the combo-box.

Event Handler:

Private Sub cmbChoice_SelectedIndexChanged(ByVal sender As System.Object, ByVal e as System.EventArgs) Handles cmbChoice.SelectedIndexChanged

insert your code here

End Sub

You can use if....then statements, case statements.... what ever your heart desires here. For example if I was doing temperature conversion using VB.NET


Dim choice as String = cmbChoice.SelectedItem.ToString()
Dim temp as double = CType(txtStart.text, double)
Dim result as double
if choice = "Celcius" then
result = insert f to c equation here
txtFinish.text = result
else
result = insert c to f equation here
txtFinish.text = result
end if


does that help at all?
__________________

Gaming

MSI MPower Z87 | 4770k | CNPS9900MAX-B | 8GB G.Skill 1866 | EVGA GTX760 |ThermalTake 850w | X-Fi Titanium | HAF | Asus PA248Q | Lycosa | Death Adder | Win8 Pro 64

Dev/Backup

MSI GD65 | 2500k | H50 | 8GB G.skill | GTX570 | Ubuntu 13.10

Laptop

17" Inspiron | i5 | 4GB DDR3 | 500GB HDD | Win7 Pro 64

jcrox is offline   Reply With Quote