Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > Beginning VB 6
|
Beginning VB 6 For coders who are new to Visual Basic, working in VB version 6 (not .NET).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning VB 6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 8th, 2006, 06:13 AM
Friend of Wrox
 
Join Date: Jan 2006
Posts: 180
Thanks: 1
Thanked 1 Time in 1 Post
Send a message via ICQ to dpkbahuguna Send a message via MSN to dpkbahuguna Send a message via Yahoo to dpkbahuguna
Default Type(Visual Basic's Structure)

Hello there!

    I want to create a Type variable but i am getting a Compiler error which is:

Cannot define a public user-defined type within a private object module.

What does it sound?

My code is:

Public Type tp
    str As String
    it As Integer
End Type
Public Sub Form_Load()
    tp.str = "de"
End Sub

Can someone help me?

Thanks....

Deepak..
__________________
DPK..
 
Old March 8th, 2006, 06:42 AM
Wrox Technical Editor
 
Join Date: Dec 2005
Posts: 271
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You forgot to create an instance of your new UDT.
Form_Load() should be something like:

Public Sub Form_Load()
    Dim typeInstance As tp
    typeInstance.str = "de"
End Sub


- A.Kahtava
 
Old March 9th, 2006, 12:00 AM
Friend of Wrox
 
Join Date: Jan 2006
Posts: 180
Thanks: 1
Thanked 1 Time in 1 Post
Send a message via ICQ to dpkbahuguna Send a message via MSN to dpkbahuguna Send a message via Yahoo to dpkbahuguna
Default



Thanks Kahtava!




Deepak..





Similar Threads
Thread Thread Starter Forum Replies Last Post
extend smartphone project type in visual studio anshuman_atri Forum and Wrox.com Feedback 0 October 6th, 2006 12:46 AM
Create a tree structure in visual C++ limkimh88 C++ Programming 7 June 22nd, 2006 11:14 PM
What value type is Global in Visual Basic? Bill_Thompson Beginning VB 6 1 May 1st, 2006 03:51 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.