Thread View: be.comp.programming
4 messages
4 total messages
Started by bernd
Sun, 21 May 2006 12:07
[VB.net]formatException
Author: bernd
Date: Sun, 21 May 2006 12:07
Date: Sun, 21 May 2006 12:07
26 lines
1892 bytes
1892 bytes
hallo, zou iemand mij kunnen helpen met het oplossen van onderstaande fout,
ergens zit een fout, maar ik weet niet wat. in visual studio wordt "Catch
exceptionObject As FormatException" als fout onderstreept, met de
foutmelding "type expected". hoe los ik dit op?
Public Class Form1
Inherits System.Windows.Forms.Form
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim side As Double
Try
side = Double.Parse(TextBox1.Text)
Label1.Text = "Area is " & CStr(side * side) _ & " sq
units"
Catch exceptionObject As FormatException
MessageBox.Show(exceptionObject.ToString)
End Try
End Sub
End Class
bedankt alvast
Re: [VB.net]formatException
Author: bernd
Date: Sun, 21 May 2006 14:03
Date: Sun, 21 May 2006 14:03
4 lines
1358 bytes
1358 bytes
mmmm, op school werkt dat exact hetzelfde programma wel, maar thuis niet. maar als ik system.FormatException schrijf werkt het wel. hoe kan dit? bij andere exceptions(bijvoorbeeld dividebyzeroexception) hoef ik geen system. ervoor te schrijven....
Re: [VB.net]formatException
Author: Jurjen de Groot
Date: Mon, 22 May 2006 07:22
Date: Mon, 22 May 2006 07:22
36 lines
2046 bytes
2046 bytes
Bernd, Je kan op 2 manieren refereren aan een type : Catch Ex As System.FormatException '// dus inclusief de volledige namespace of Imports System '// namespace importeren Public Sub ... ... jouw code ... Catch Ex As FormatException '// dan zonder namespace refereren ... Je kan ook op project nivo namespace imports definieren (selecteer je project, rechtsklik, properties, dan onder common properties - Imports. Op die manier hoe je deze niet als imports statements in je code te zetten. wellicht dat dat verklaart waarom het op school wel werkt en thuis niet. Jurjen. "bernd" <spurnd@belgacom.net> wrote in message news:44707329$0$13882$ba620e4c@news.skynet.be... > mmmm, op school werkt dat exact hetzelfde programma wel, maar thuis niet. > maar als ik system.FormatException schrijf werkt het wel. hoe kan dit? bij > andere exceptions(bijvoorbeeld dividebyzeroexception) hoef ik geen system. > ervoor te schrijven.... >
Re: [VB.net]formatException
Author: bernd
Date: Mon, 22 May 2006 14:33
Date: Mon, 22 May 2006 14:33
46 lines
2511 bytes
2511 bytes
klopt, maar waarom dan alleen bij de formatException? en niet bij bijvoorbeeld DivideByZeroException ofzo? bedankt alvast "Jurjen de Groot" <Jurjen.de.Groot@xs4all.nl> schreef in bericht news:447166e8$0$31649$e4fe514c@news.xs4all.nl... > Bernd, > > Je kan op 2 manieren refereren aan een type : > > Catch Ex As System.FormatException '// dus inclusief de volledige > namespace > > of > > Imports System '// namespace importeren > > Public Sub ... > > ... jouw code ... > > Catch Ex As FormatException '// dan zonder namespace refereren > > ... > > Je kan ook op project nivo namespace imports definieren (selecteer je > project, rechtsklik, properties, dan onder common properties - Imports. Op > die manier hoe je deze niet als imports statements in je code te zetten. > wellicht dat dat verklaart waarom het op school wel werkt en thuis niet. > > Jurjen. > > > > > "bernd" <spurnd@belgacom.net> wrote in message > news:44707329$0$13882$ba620e4c@news.skynet.be... >> mmmm, op school werkt dat exact hetzelfde programma wel, maar thuis niet. >> maar als ik system.FormatException schrijf werkt het wel. hoe kan dit? >> bij andere exceptions(bijvoorbeeld dividebyzeroexception) hoef ik geen >> system. ervoor te schrijven.... >> > >
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads