Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

drawing on a form

Status
Not open for further replies.

sahmiele

Technical User
Sep 9, 2003
67
US
Is there any way to draw a line on a form? I can't figure it out to save my life! the form name is MainMenu. Any help would be greatly appreciated.
 
Do you want to draw a line during the design of the Form (there is a control in your ToolBox called Line, you know), or when you run your app and you want your users to be able to draw line(s) on the Form?

---- Andy
 
both would be nice to know. I do not have have a control in my toolbox for Line.
 
If you are using VB 6 (and not VB.NET, that's another Forum) you should have a Line in your toolbox:

line.JPG


---- Andy
 
The toolbox icon is greyed out while i am looking at the code, and I can't bring it up. my visual basic version is:

Microsoft Visual Basic 6.3
Version 9969 VBA: Retail 6.4.8869 Forms3: 11.0.5709

Could you post the full code above? Then I can modify it. Thanks!
 
Sure :)
Code:
Option Explicit
Dim i As Integer

Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim my_line As Control

Set my_line = Me.Controls.Add("VB.Line", "Line" & i)

With my_line
    .X1 = X
    .X2 = Y
    .Y1 = 2040
    .Y2 = 480
    .Visible = True
End With

i = i + 1

End Sub

Your VB may not be installed properly, or the dll (ocx?) for a like control is missing/corrupted.

Let me know if it works.

Have fun

---- Andy
 
still no luck. Any ideas on how to find/reinstall the necessary dll?
 
Are there any other controls greyed out in your toolbox?
They all should be available to you right from the box.

I would suggest re-installing your VB, sorry.

Who knows what else is messed up in your VB, I would re-install it.

---- Andy
 
<<The toolbox icon is greyed out while i am looking at the code>>

You should be looking at the Form, if you want to place the line on the Form at design time.

HTH Hugh,
 
When I am looking at the form, the toolbox does not have a "line" option. When I am looking at the code, I can not even click on the toolbox. It is greyed out.
 
I understand, but when I am looking at the form, the "line" button is not in my toolbox. That is why I'm stuck. I have no way to get a line on the form, by design or by code.
 
strongm, any way to do this in VB 6? I did post this in the VB 5 & 6 forum, not the VBA one, or did I put it in the wrong one?
 
>any way to do this in VB 6?

Yes, I gave you code

>I did post this in the VB 5 & 6 forum, not the VBA one,

This IS VB 5 & 6 forum

>or did I put it in the wrong one?

The Forum is the right one, just you are using another language - you are using VBA (Visual Basic for Applications) which is NOT VB6

---- Andy
 
When I click Help, about microsoft visual basic, why does it say visual basic 6.3, not visual basic for applications x.x? the code above did not work.
 
the code above did not work in VBA, it will work fine in VB.

You also have this line:
Version 9969 VBA: Retail 6.4.8869 Forms3: 11.0.5709

>why does it say visual basic 6.3,

You would have to ask Bill Gates about it :)

---- Andy
 
Did you get to your visual basic from Access/Word/Excel/Powerpoint/Outlook or other Office product or did you get to it from Visual Studio?

If you got to it from any Office product then you're using VBA - If you've bought and installed Visual studio/Visual Basic as a seperate program then you could be using VB6 BUT VB6.3 is simply a version of VBA - it's NOT VB6

___________________________________________________________
If you want the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Drive a Steam Roller
Steam Engine Prints
 
>You also have this line:
>Version 9969 VBA: Retail 6.4.8869 Forms3: 11.0.5709


VB6 will also mention VBA in 'Help/About' ...


Generally speaking VBA 6.0.v is VB6, VBA anything else isn't.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top