0

i used to create sub procedures in vb6 under tools/ add procedure. Same is not available in vb2008. how can i create sub procedure in form.

for eg.

Private Sub CmdDisabl()
Cmd_New.Enabled = False
Cmd_Amend.Enabled = False
End sub

if i type above code in form i get error

statement is not valid in namespace

if i create module and put above code in it , gives erroe

Cmd_New is not declared

how to create procedure at form level in vb2008
thanks

4
Contributors
6
Replies
9
Views
5 Years
Discussion Span
Last Post by codeorder
0

What kind of error do you get in the form when you type that??

Votes + Comments
-=1 because I dealt w/an Unhandled Exception for about an hour earlier, not fun at all. :D
0

open your form in the design-view. Click F7 to get in to the code behind file.
You have to create your procedure inside the Class.
IE: (asuming your form name is Form1...)

Public Class Form1

Private Sub CmdDisabl()
 Cmd_New.Enabled = False
 Cmd_Amend.Enabled = False
End sub

End Class
0

i am getting error in class

Name 'Cmd_New' is not declared
Name 'Cmd_Amend' is not declared

why i need to declare command name againe

Thanks

0

Have you tried adding the Form's.Name just prior to your Cmd_New.Enabled... ?

Example: Form1.Cmd_New.Enabled = False

Votes + Comments
I guess the same reason as yours.
0

8 Hours Ago

>>adding form name has solved the problem

Not marking the thread as Solved, gave me a problem? and I have no problematic questions.(sigh) I would cuss you out, though it's morning and I already cussed out a neighboor; hope the previous sentence takes care of your "other" problem, not keeping it IT in an IT forum.

Other than that, glad I could help.:)

Edited by codeorder: n/a

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.