473,546 Members | 2,205 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

VB 2005 Newbie Questions

2 New Member
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.tota ldays.

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
2 2652
Taftheman
93 New Member
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.tota ldays.

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.refres h

and

try adding indexs to the combo box
Nov 23 '06 #2
alexandercowan
2 New Member
Firstly try refreshing your text box

textbox1.refres h

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

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

Similar topics

6
2124
by: sathyashrayan | last post by:
Following are the selected thread from the date:30-jan-2005 to 31-jan-2005. I did not use any name because of the subject is important. You can get the original thread by typing the subject "string" in google comp.lang.c archives.Hope this helps.Hope I am not bothering any one. am I? ...
4
1201
by: Shawn | last post by:
Hi. When I started using VS.NET 2003 there was no problem upgrading all my projects to VS.NET 2003 Framework 1.1. Everything worked as it used to under framework 1.0. Is it easy to upgrade from framework 1.1 to VS.NET 2005 Framework 2.0? Will everyting work as it used to, or do I have to re-write some of my code? Thanks Shawn
11
1195
by: Brian | last post by:
Hello, In Web Matrix, I am able to work on a single ASPX file and double click on a control and it will take me to the subroutine so I can code the button. In Visual Web Developer, if I do the same (single ASPX file, double click on a control) it takes me to the HTML code and not the VB code. Why is this?
2
1375
by: CK | last post by:
Previously in Sql Server 2000, we would be in enterprise manager, you'd double click on a view, and a nice little dialog box opened with the t-sql statetments, there was also a check sql syntax and apply and cancel buttons. Not exactly query anaylizer, just a quick lightweight dialog box. Is this feature still around? Seems like I have to go...
13
2100
by: josh | last post by:
I'm pretty new to both sql 2005 and VB but please bear with me. I have installed SQL 2005 express on a Windows 2003 Standard server. I have also installed VB 2005 Express edition on the server. SQL seems to be running fine (I can create databases, tables, modify them, etc.) I have created a very basic app in VB express that just lets me view...
2
2083
by: kress1963nov22 | last post by:
I recently purchased a good MS book ("Build a Web Site Now") by Jim Buyens. It has the Express Edition of MS-Visual Web Developer 2005 on CD and also MS SQL Server 2005 Express Edition on the CD. A couple of questions for this newbie: Can MS SQL Server 2005 Express Edition be used in place of the older MSDE product for backend database work? I...
10
27997
by: Nicholas Zhou | last post by:
Sorry if this sounds stupid. I am a total newbie.... Can I compile C program in Visual Studio 2005 IDE? I wrote the simple "Hello World" program in it: ------------------------------------ #include <stdio.h> main()
0
986
leafgreen
by: leafgreen | last post by:
Hey everyone. Thanks for helping me with these two super-simple newbie questions. I use DW8. 1. On this page http://adswebsite.net/yahoo-search-versus-google-adwords, on the right column where it says "More AdsWebsite Guides" and below that, the colored cells/rows are taller than I want. How can I keep them about the same height as the text for...
0
7507
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7435
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7698
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
5361
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5080
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3492
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3472
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1046
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
747
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.