Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Greetings,

I get " 'sub Main' was not found in Structure.' �error when I attempt to compile this. Why am I getting this error?

 


Public Structure customer

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

End Structure


 


   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

  • *Experts*
Posted

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

"I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...