Computing.Net > Forums > Programming > how to add a namespace to VB code

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

how to add a namespace to VB code

Reply to Message Icon

Name: Alam
Date: April 10, 2003 at 13:33:01 Pacific
OS: Win 98
CPU/Ram: P III, 256 MB
Comment:

I want to execute the code below.

Public Sub CreateMyLabel()
' Create an instance of a Label.
Dim label1 As New Label()

' Set the border to a three-dimensional border.
label1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
' Set the ImageList to use for displaying an image.
label1.ImageList = imageList1
' Use the second image in imageList1.
label1.ImageIndex = 1
' Align the image to the top left corner.
label1.ImageAlign = ContentAlignment.TopLeft

' Specify that the text can display mnemonic characters.
label1.UseMnemonic = True
' Set the text of the control and specify a mnemonic character.
label1.Text = "First &Name:"

' Set the size of the control based on the PreferredHeight and PreferredWidth values.
label1.Size = New Size(label1.PreferredHeight, label1.PreferredWidth)

'...Code to add the control to the form...
End Sub

But it requires System.drawing namespace to be added to the Form containing this code. Can I get some help about adding a namespace to a Form (Visual Basic)



Sponsored Link
Ads by Google

Response Number 1
Name: Matthew
Date: April 10, 2003 at 15:07:58 Pacific
Reply:

To add a namespace just add the following lines of code to the very top of your page (before the class opens)

Imports xxxx
in your case it would look like

Imports System.Drawing

Class MyClass....


0

Response Number 2
Name: Alam
Date: April 11, 2003 at 11:49:44 Pacific
Reply:

Hi Mathew,
Thanks for helping. But I could not use "Import System.Drawing" in VB. I included this statement in my VB form(which is the only form in the project) and also in a class(build with class builder), but it's showing error for the keyword "Import". Can you please be a bit specific about how to use this statement in a VB project? Waiting for your answer. u can mail me at bahar_ul_alam@yahoo.com or post a message here, as you wish.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: how to add a namespace to VB code

PDF how can I add a jpg to page www.computing.net/answers/programming/pdf-how-can-i-add-a-jpg-to-page/4234.html

how to add a text in a file www.computing.net/answers/programming/how-to-add-a-text-in-a-file-/19717.html

How to debug MFC DLL? www.computing.net/answers/programming/how-to-debug-mfc-dll/6960.html