Java to VB.Net question

  • Thread starter Thread starter Michael Murphy
  • Start date Start date
M

Michael Murphy

Hi, could someone help me along with a Java to VB.Net conversion.


Here is the java code

private sub test1() throws Exception
{
//code in here
}

private sub test2()
{
//code in here
}



And here is my conversion for subroutine test2 - but what is the
VB.Net equivalent for test1 ?


Private Sub test2()
'code in here
End Sub

Thanks
Michael
 
If I understand correctly you are trying to catch an exception.

For this in VB.Net you can use a try catch block

Private Sub Test1()
Try
'code in here
Catch exc as exception
'code in here to act on exc
End Try
End Sub
 
You have mixed your Java and VB.Net already, a slippery slope indeed! Your
original Java should have read:



private void test1() throws Exception
{
//code in here
}

private void test2()
{
//code in here
}


Now in answer to your original question about conversion - ** there are no
checked exceptions in VB.Net **. The "conversion" of both test1 and test2 is
shown below.


Private Sub test2()
'code in here
End Sub

Private Sub test1()
'code in here
End Sub


The JLCA available from Microsofts web site (albeit J to C#) and other
on-line resources will be about to point you in the right direction for
further conversions.

Hexathioorthooxalate
 
Back
Top