[mono-vb] If Else, When in VB ASP.NET

Tue Doan Nguyen Tue Doan Nguyen" <minhtue@saigonnet.vn
Wed, 13 Oct 2004 11:52:56 +0700


Hi Jambunathan,

This is some other errors that I face when i try to compile .vb file. Please
give me a favour !

This is a code snippet that use "When " keyword

Try

thisId = Request.QueryString("id")

Catch ex As Exception When 1=1

Response.Redirect("thread.aspx")

End Try

----------------------------

ERROR MESSAGE:

syntax error, got token `WHEN', expecting AND ANDALSO DEFAULT END EOL EVENT
FRIE
ND FUNCTION IMPLEMENTS IS MOD MUSTINHERIT NOTINHERITABLE NOTOVERRIDABLE OR
ORELS
E OVERLOADS OVERRIDABLE OVERRIDES PRIVATE PROPERTY PROTECTED PUBLIC READONLY
SHA
DOWS SHARED STEP SUB THEN TO WRITEONLY XOR OPEN_PARENS OPEN_BRACE
CLOSE_BRACE CL
OSE_PARENS DOT COMMA COLON PLUS MINUS ASSIGN OP_LT OP_GT STAR DIV OP_EXP
OP_IDIV
 OP_CONCAT OP_LE OP_GE OP_NE OP_SHIFT_LEFT OP_SHIFT_RIGHT
reply.aspx.vb(32,25) error BC29999: Parsing error
Compilation failed: 1 Error(s), 0 warnings

----------------------------------------------------

And any "If  Else" leads to the ERROR:

syntax error, got token `ELSE', expecting AND ANDALSO EOL IS MOD OR ORELSE
STEP
THEN TO XOR OPEN_PARENS CLOSE_BRACE CLOSE_PARENS DOT COMMA COLON PLUS MINUS
ASSI
GN OP_LT OP_GT STAR DIV OP_EXP OP_IDIV OP_CONCAT OP_LE OP_GE OP_NE
OP_SHIFT_LEFT
 OP_SHIFT_RIGHT
topicAdd.aspx.vb(51,45) error BC29999: Parsing error
Compilation failed: 1 Error(s), 0 warnings



Thanks

BIB



----- Original Message -----

From: "Jambunathan Jambunathan" <kjambunathan@novell.com>
To: <minhtue@saigonnet.vn>
Cc: <mono-vb@lists.ximian.com>
Sent: Tuesday, October 12, 2004 12:39 PM
Subject: Re: AW: [mono-vb] Inherits in VB ASP.NET


> Hello
>
> As the implementation of ":" is not yet complete, you can,
> for now, use an "actual end of line" instead of ":" as the
> terminator.
>
> So replace,
>
> Public Class viewAllRecords : Inherits System.Web.UI.Page
>
> with
>  Public Class viewAllRecords
>                         Inherits System.Web.UI.Page
>
> I have made a note of this scenario in mbas test cases.
>
> I appreciate you taking time to report this.
>
> Regards,
> Jambunathan K.
>
> >>> "Tue Doan Nguyen" <minhtue@saigonnet.vn> 10/11/04 9:38 PM >>>
> THIS IS THE CODE SNIPPET
> -----------------
> Imports System
>
> Imports System.Data
>
> Imports System.Data.OleDB
>
> Imports System.Configuration
>
> Imports System.Web.UI.WebControls
>
> Imports System.Web.UI.HtmlControls
>
> Imports dotForumIncludes
>
> Namespace dotForumClientTopic
>
> Public Class viewAllRecords : Inherits System.Web.UI.Page
>
> Public myIncludes As New includeFunctions
>
> Protected dotForumDisplay As System.Web.UI.WebControls.DataGrid
>
> Protected messageCenter As
> System.Web.UI.HtmlControls.HtmlGenericControl
>
> Protected threadLink As System.Web.UI.HtmlControls.HtmlGenericControl
>
>
> Public pageTitle As String = " .: ITCN Asp.Net Forum 2004 :. "
>
> Public pageDesc As String = "ITCN Asp.Net Forum 2004"
>
> Public pageKeys As String = ".net, asp.net, asp, visual basic,
> microsoft,
> itcn, programming, server, clr, net, discussion, forum, discussion
> board,
> free, source code, open source"
>
> Sub Page_Load(sender as Object, e as EventArgs)
>
> If Not Page.IsPostBack then
>
> bindData()
>
> End If
>
> End Sub
>
>
>
> Sub bindData()
>
> Dim myConnection as New
>
oleDBConnection("Provider=SQLOLEDB;server=localhost;uid=sa;pwd=;database=For
> um200412")
>
> Dim myCommand as New oleDBCommand("SELECT bcId, Left(bcTitle, 100) As
> bcTitle, bcDesc, bcOrder, bcLastUpdate, bcLock FROM forumTopics ORDER
> BY
> bcOrder, bcLastUpdate DESC", myConnection)
>
> Dim myDA as New oleDBDataAdapter()
>
> myDA.SelectCommand = myCommand
>
> Dim myDS as New DataSet()
>
> myDA.Fill(myDS)
>
>
> dotForumDisplay.DataSource = myDS
>
> dotForumDisplay.DataBind()
>
> '### CHANGE THE FOLDER IMAGE BASED ON ATTRIBUTES
>
> Dim gridrow As DataGridItem
>
> Dim folderString As String
>
> Dim folderAltString As String
>
> Dim thisDate As Date
>
> Dim currentDate As Date = Microsoft.VisualBasic.Format(DateTime.Now,
> "MM-d-yyyy")
>
> For Each gridrow In dotForumDisplay.Items
>
> If CType(gridrow.FindControl("bcLock"), HtmlInputHidden).Value = "y"
> Then
>
> folderString = "gfx/forum/folder_locked"
>
> folderAltString = ", Locked"
>
> Else
>
> folderString = "gfx/forum/folder"
>
> folderAltString = ""
>
> End If
>
> thisDate = CType(gridrow.FindControl("bcLastUpdate"),
> HtmlInputHidden).Value
>
> If Microsoft.VisualBasic.Format(thisDate, "MM-d-yyyy") = currentDate
> Then
>
> folderString = folderString & "_new.gif"
>
> folderAltString = folderAltString & ", New Activity"
>
> Else
>
> folderString = folderString & ".gif"
>
> End If
>
> CType(gridrow.FindControl("folderImage"), Image).ImageUrl =
> folderString
>
> CType(gridrow.FindControl("folderImage"), Image).AlternateText =
> CType(gridrow.FindControl("bcTitle"), HyperLink).Text &
> folderAltString
>
> Next
>
> '### DISABLE NEXT/PREV IF LESS THAN dotForumDisplay.PageSize
>
> If myDS.Tables(0).Rows.Count < dotForumDisplay.PageSize Then
> dotForumDisplay.PagerStyle.Visible = False
>
> End Sub
>
>
>
> Sub dotForumDisplay_Paged(sender as Object , e as
> DataGridPageChangedEventArgs)
>
> dotForumDisplay.CurrentPageIndex = e.NewPageIndex
>
> bindData()
>
> End Sub
>
> End Class
>
>
>
> End Namespace
>
> ----------------------------------------------------
>
> AND  THIS IS THE ERROR MESSAGE
>
>
> --------
> MonoBASIC: THIS IS STILL ALPHA AND UNSUPPORTED SOFTWARE, USE AT YOUR
> OWN
> RISK.
> --------
> syntax error, got token `COLON', expecting EOL
> forum.aspx.vb(11,26) error BC29999: Parsing error
> Compilation failed: 1 Error(s), 0 warnings
>
> ------------------------------------------------------
>
> IF I CLEAR THE COLON ":", THE ERROR BECOMES:
>
> --------
> MonoBASIC: THIS IS STILL ALPHA AND UNSUPPORTED SOFTWARE, USE AT YOUR
> OWN
> RISK.
> --------
> syntax error, got token `INHERITS', expecting EOL
> forum.aspx.vb(11,33) error BC29999: Parsing error
> Compilation failed: 1 Error(s), 0 warnings
>
> Thanks
>
>