Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / April 2006

Tip: Looking for answers? Try searching our database.

Debugging Errors

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Merlyn-12 - 03 Apr 2006 07:29 GMT
I have installed Visual Studio 2003 on a laptop that has XP Home as the
opperating system.  There were no error messages when I installed.  I have
tried to write my first program in VB.  I am using the LEFT function to give
me the first 5  characters in a text box.   The basic statement is a follows.
strTemp = Left(strText1, 5)
Where strTemp and strText1 are string variables
When I run it gives me an error saying that the Left() only excepts integers.
If I tell it to ignore the error and continue, it evaluates the statement  
properly.
Later in the same code I have an if statement.
IF strText2 = "Now" then
and not mater what is in strText2, the statement evaluates to TRUE.
These 2 problems have me concerned about the installation of Visual Studio.
Any sugestions on where to look for a salution.
pvdg42 - 03 Apr 2006 12:51 GMT
>I have installed Visual Studio 2003 on a laptop that has XP Home as the
> opperating system.  There were no error messages when I installed.  I have
[quoted text clipped - 14 lines]
> Studio.
> Any sugestions on where to look for a salution.

I don't think there is anything wrong with your installation. Try code like
this to use the Left() function:

Dim s As String

s = Microsoft.VisualBasic.Left(TextBox1.Text, 5)

If s = "12345" Then

Label1.Text = "67890"

Else

Label1.Text = "00000"

End If

The code above works fine here.

You might also consider looking through the help at the various methods
available to you in the .NET String class for text handling.
Homer J Simpson - 12 Apr 2006 22:41 GMT
> I have installed Visual Studio 2003 on a laptop that has XP Home as the
> opperating system.  There were no error messages when I installed.  I have
[quoted text clipped - 14 lines]
> Studio.
> Any sugestions on where to look for a salution.

Can you provide a LITTLE more code?
Try:-

Imports Microsoft.VisualBasic

Dim strText1 As String = "TestLine"
Dim strTemp As String, strText2 As String
If Len(strText1) > 4 Then
   strTemp = Microsoft.VisualBasic.Left(strText1, 5)
End If
strText2 = "Then"
If strText2 = "Now" Then strText2 = "OK!"
Homer J Simpson - 13 Apr 2006 00:50 GMT
> I have installed Visual Studio 2003 on a laptop that has XP Home as the
> opperating system.  There were no error messages when I installed.  I have
[quoted text clipped - 6 lines]
> When I run it gives me an error saying that the Left() only excepts
> integers.

Found the problem. 'Left' is a function used in WinForms. You need to use

Microsoft.VisualBasic.Left

to disambiguate it and make it work.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.