如何在vb6中以其他形式使用类对象
我正在尝试以不同的形式访问一个类对象来调用它的方法..你能告诉我我该怎么做吗..? 这是我的代码..
Dim a As customers
Private Sub Command1_Click()
Dim txt1 As String
Dim txt2 As String
Set a = New customers
txt1 = Text1.Text
txt2 = Text2.Text
a.userid = txt1
a.log_in txt1, txt2
End Sub
它是我在表格 1 中编写的代码....用于登录.. 为客户 n 制作了一个称为日志程序的对象... 如果它成功登录,我将打开一个新表单 只显示.. 以及在家里...... 选项在那里 查看个人资料 我在其中展示了另一个表单配置文件 并在其加载方法中想要调用 a 的另一个方法来显示配置文件.. 它如何知道应该显示谁的个人资料......在这里我很困惑 因为我是VB新手,请帮帮我...请...
i am trying to access a class object in different form to call its method ..can u plz tell me how can i do it..?
here is my code..
Dim a As customers
Private Sub Command1_Click()
Dim txt1 As String
Dim txt2 As String
Set a = New customers
txt1 = Text1.Text
txt2 = Text2.Text
a.userid = txt1
a.log_in txt1, txt2
End Sub
its a code i have written in form 1....for login..
made an object for customer n called loging procedure...
in that if it sucesfully logs in i m opening a new form
homw.show only..
and in home......
option is there
view profile
in which i am showing another form profile
and in its load method want to call a's another method for displaying profile..
how it can know whose profile it should display....here i m getting cofused
as m new to vb help me out...plz..
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在第二个表单上实现 init 方法,并在 Command1_Click 中使用它,如下所示
在
Init
中,您可以调用Show
来显示Form2
的实例。您还可以将在Form_Load
中执行的所有操作移至这个简单的Init
方法 - 例如填充组合框等。Implement an init method on the second form and use it in Command1_Click like this
In
Init
you can callShow
to display the instance ofForm2
. You can also move everything you do inForm_Load
to this simpleInit
method -- like filling comboboxes etc.