467,879 Members | 1,087 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,879 developers. It's quick & easy.

VB 2005 Newbie Questions

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
  • viewed: 2554
Share:
2 Replies
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
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.

Similar topics

6 posts views Thread by sathyashrayan | last post: by
4 posts views Thread by Shawn | last post: by
11 posts views Thread by Brian | last post: by
2 posts views Thread by kress1963nov22 | last post: by
10 posts views Thread by Nicholas Zhou | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.