Results 1 to 5 of 5

Thread: How can I make it PUBLIC?!!

  1. #1

    Thread Starter
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428

    Unhappy How can I make it PUBLIC?!!

    Well! In VB6 I can make a Public TYPE and put it in a module and it will be accessible everywhere in my project. I want to have a STRUCTURE and have it accessible to all my forms and classes. How can I do this in VB.NET?
    I tried to define a namespace and put the structure and the class in the same namespace and it works. But what if I have a separate class and I want my structure to be accissble to my class and my forms?

    (begginerish question? )
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  2. #2
    Thelonius
    Guest
    Add a new class (to your project

    type this

    Public Class MyStructures

    Public Structure myBlah
    Dim item1 As String
    Dim item2 As String
    Dim item3 As Integer
    End Structure

    End Class

    In your form code type

    Dim blah As MyStructures.myBlah

    blah.item1 = "Hello"
    blah.item2 = "World"
    blah.item3 = 3
    Console.WriteLine("item1=" & blah.item1)
    Console.WriteLine("item2=" & blah.item2)
    Console.WriteLine("item3=" & blah.item3)

  3. #3

    Thread Starter
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428
    tnx alot
    Also is there a way to make them access it like this:


    Class something
    private myStruct as MyPublicStructure
    End Class


    and do same thing in form

    private myStruct as MyPublicStructure



    is there a way to define MyPublicStructure so it can be accessed that way?

    thanks for any help
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  4. #4
    Thelonius
    Guest
    What are you trying to accomplish? It might be helpful if you posted your code.

  5. #5

    Thread Starter
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428
    havent done anything yet, I was just trying to START a new app and I figured out that I can't make the structure that way
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width