By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,557 Members | 1,164 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,557 IT Pros & Developers. It's quick & easy.

VB 2005 Newbie Questions

P: 2
Hi All,

Sorry for these really pathetic questions, but I have been playing on VB 2005 today, and I am stumped.

First question

I have created a sub to calculate the difference in days of 2 datepickers and for the result to be displayed in a text box, but I cant get the result to display until I click in the text box and press a key...is there a way to generate the result without an event? The code I have used is as follows:

Dim date1 As New Date
Dim date2 As New Date
Dim difference As TimeSpan

date1 = DateTimePicker1.Value
date2 = DateTimePicker2.Value

difference = date1.Subtract(date2)

textbox1.text = difference.totaldays.

Lastly (for now)

I have created a combo box which contains 3 items, is there a way to get a result populated into a text box varying for each choice.

For example

First class (result in text box = 50.00)
Second Class (result in text box = 60.00)

Etc..

Many thanks in advance.

Alex
Nov 23 '06 #1
Share this Question
Share on Google+
2 Replies


P: 93
Hi All,

Sorry for these really pathetic questions, but I have been playing on VB 2005 today, and I am stumped.

First question

I have created a sub to calculate the difference in days of 2 datepickers and for the result to be displayed in a text box, but I cant get the result to display until I click in the text box and press a key...is there a way to generate the result without an event? The code I have used is as follows:

Dim date1 As New Date
Dim date2 As New Date
Dim difference As TimeSpan

date1 = DateTimePicker1.Value
date2 = DateTimePicker2.Value

difference = date1.Subtract(date2)

textbox1.text = difference.totaldays.

Lastly (for now)

I have created a combo box which contains 3 items, is there a way to get a result populated into a text box varying for each choice.

For example

First class (result in text box = 50.00)
Second Class (result in text box = 60.00)

Etc..

Many thanks in advance.

Alex
Firstly try refreshing your text box

textbox1.refresh

and

try adding indexs to the combo box
Nov 23 '06 #2

P: 2
Firstly try refreshing your text box

textbox1.refresh

and

try adding indexs to the combo box

hi, thanks for your response, how would i add indexes to the combo box?
Nov 23 '06 #3

Post your reply

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