Simple DataStructure Problem

Kmax

Newcomer
Joined
Feb 17, 2002
Messages
5
Location
Montana, USA
Greetings,
I get " 'sub Main' was not found in Structure.' “error when I attempt to compile this. Why am I getting this error?

Code:
Public Structure customer

    'members...
    Public fName As String
    Public lName As String
    Public eMail As String

End Structure

Code:
    Private Sub btnTest_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTest.Click
        'create a new customer...
        Dim testCustomer As customer
        testCustomer.fName = "Amir"
        testCustomer.lName = "Aliabadi"
        testCustomer.eMail = "amir@pretendcompany.com"
        'Display the company...
        displayCustomer(testCustomer)
    End Sub

    'DisplayCustomer - show the customer...
    Public Sub displayCustomer(ByVal customer As customer)

        'update the fields...
        txtfName.Text = customer.fName
        txtlName.Text = customer.lName
        txtEMail.Text = customer.eMail
    End Sub
 
Check your project properties. See what the Startup Object is set to. If you're creating a Windows Application you'll need a Sub Main or a startup form. If you create a new project you can see what Sub Main should look like. You can then cut and paste that function to your real project and change the form that's referenced there.

If you still can't get this to work, upload a zip of your project and we'll get you going.

-ner
 
Back
Top