|
-
Nov 10th, 2002, 04:29 PM
#1
Thread Starter
New Member
Define a Public Sub?
Okey, I'm on the road again.
My code all ready and done BUT I get the following error:
"Define a Public Sub Main procedure for your project. Declare it as Shared if and only if you define it inside a class"
Now how do I "define" this?
I've got a Public Sub Main() and a End Sub of course but nothing inside it... All my code is behind a button.
Hard getting used to all this .NET stuff... boot cool 
: Todd
-
Nov 10th, 2002, 08:48 PM
#2
Right click on the Project and check in the properties to make sure you have a valid form set as the startup object. If you change the name of the form sometimes the IDE doesn't pick it up and thinks there is no startup form and so it prompts you for a Sub Main.
-
Nov 11th, 2002, 10:57 AM
#3
Thread Starter
New Member
Shoot, sorry about double posting
Shoot, sorry about double posting.
I didn't quite catch that one? Can you explain it more clearly please?
Todd
-
Nov 11th, 2002, 11:44 AM
#4
Right click on the project in the Solution Explorer and choose Properties from the context menu. That will bring up the property page and you can choose a startup object from there:
-
Nov 11th, 2002, 01:06 PM
#5
Thread Starter
New Member
Done that now.
Okey, thanx. Now I've done that boot still I get an error trying to build it.
First the Visual Studio tells me that the Project1.exe is missing so there it cannot debug since the debug target is missing. Whats that all about?
In the task list shown after I've built the project (and failed) I get this message:
"No accessible 'Main' method with an appropriate signature was found in 'Project1.Counter2'."
"I was put on this earth to accomplish a certain number of things,
right now I'm so far behind I'll never die"
: Todd
-
Nov 11th, 2002, 01:41 PM
#6
What is Counter2 in your project? Is it a module? A form?
Are you referencing another project?
It sounds like you referenced Project1 and it hasn't been built or has been deleted from the bin folder of the current project. Check your references for a yellow cation icon with an exclamation on it. That indicates a bad reference, if you find one then delete/remove it. If you really need to reference that item then just re-reference it.
-
Nov 11th, 2002, 02:53 PM
#7
Thread Starter
New Member
Counter2
****er2 is the name of the form.
IS this wrong? Shouldn't there be any numbers in a name? Got a hard time believeing that.
Should I name it what it was originally called? UserForm1 or someting...?
I'm not reffering to anything outside the project....
I know it's stupis to call the textboxew counterTWO and so on instead of counter2 and so on, but that's the way I happend to do it. It really doesn't matter though....
I left out all the code generated by IDE.
------------------------------------------------------------------------------
VB.NET code
------------------------------------------------------------------------------
Public Sub Main()
End Sub
Public Function bin(ByVal x As Integer) As String
While x
bin = IIf(x Mod 2, "1", "0") & bin(Me.counter.Text)
x = x \ 2
End While
End Function
Public Sub Button1_Click()
Me.counter.Text = Me.counter.Text + 1
Me.counterTWO.Text = Hex(Me.counterTWO.Text)
Me.counterTHREE.Text = bin(Me.counter.Text)
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|