|
-
Oct 30th, 2004, 04:33 AM
#1
Thread Starter
Addicted Member
VB.NET: Option Strict ON conversion....[Resolved]
I heard that working on codes with Option Strict ON give me a better way to learn programming....
Say I have turn the Option Strict ON....
all the coding works well when the option Strict is OFF.....
1) How to convert the error "String to Integer" in this case
Code:
Dim data As String
For Each nod As XmlNode In xdoc.SelectNodes("//time")
data = nod.Attributes("hour").Value
cboVHour.SelectedIndex = data
Next
2) Secondly, I have this String which take in Integer, how to solve the error "Integer to String" in the second case.
Code:
Dim dd As Integer
dd = Now.Day
lblDay.Text = dd
3) Lastly, I have an Xml String and I wanted to display an additional day to it in the Xml String. How to solve thr error "String to Double" in this third case.
Code:
XmlString = "<OK>" & dd + 1 & "</OK>"
Thanks
Last edited by toytoy; Dec 3rd, 2004 at 07:50 AM.
-
Oct 30th, 2004, 04:44 AM
#2
Registered User
Hi,
I'm no master programmer yet, and don't have vb.net on the machine I'm on now.
Just wanted to say, Don't give up on using Option Strict On. Forces you to figure out the "right" way of doing things.
From the top of my head:
1) Play around with adding .ToString (like nod.Attributes("hour").Value.ToString
2) Pllay around with CType and DirectCast
Good Luck
-
Oct 30th, 2004, 08:15 AM
#3
The Convert class allows you to do most of what you want to do.
I use Microsoft Visual Basic 2005. (Therefore, most code samples I provide will be based around the .NET Framework v2.0, unless otherwise specified)
-
Oct 30th, 2004, 08:18 AM
#4
Thread Starter
Addicted Member
Last edited by toytoy; Dec 3rd, 2004 at 07:50 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|