how to solve the problem

Steven143

New member
Joined
Jan 10, 2008
Messages
3
Programming Experience
Beginner
VB.NET:
Public Sub DrawBoard()
        '---used to store the location of the cell---
        Dim location As New Point
        '---draw the cell---
        For row As Integer = 1 To 9
            For col As Integer = 1 To 9
                location.X = col * (CellWidth + 1) + xOffset
                location.Y = row * (cellHeight + 1) + yOffset
                Dim lbl As New Label
                With lbl
                    .Name = col.ToString() & row.ToString()
                    .BorderStyle = BorderStyle.Fixed3D
                    .Height = cellHeight
                    .Width = CellWidth
                    .BackColor = DEFAULT_BACKCOLOR
                    .Location = location
                    .Tag = "1"
                    AddHandler lbl.Click, AddressOf Cell_Load
                End With
                [COLOR="Red"]Me.Controls.Add(lbl)[/COLOR]
            Next
        Next
    End Sub

can someone help me how to solve the problem... I'm new to vb.net the error msg is "Value of type 'System.Windows.Forms.Label' cannot be converted to 'System.Web.UI.Control' " what i need to do to make it work? By the way sorry if i post at the wrong thread.:p
 
Quite eluding ;)
Either you've created a winforms project and written a class that inherits System.Web.UI.Control.
Or you've created a webforms project, added reference and Imports for System.Windows.Forms.
Both wrong, which is it? :)
 
Quite eluding ;)
Either you've created a winforms project and written a class that inherits System.Web.UI.Control.
Or you've created a webforms project, added reference and Imports for System.Windows.Forms.
Both wrong, which is it? :)

yup...yup... if according to what you say. then mean i both wrong ad.:eek:
so what i need to do correct it? i wanna make it at the web base, so i can't imports system.windows.forms is it... but seems like if not using the reference, i can't use ".location" and ".tag"....:confused:
 
Winforms and Webforms projects are different types, first is for Windows client applications, the other for ASP.Net server applications. I don't know what these projects are called in full version Studio or what Studio edition you have, but for Express editions you can only create winforms project types with Visual Basic 2005 Express and only webforms project types with Visual Web Developer 2005 Express. Create a correct project type for web or desktop and you'll be sorted out.
 
Back
Top