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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using a user control with MS Word

Status
Not open for further replies.

mathprof

Programmer
Nov 8, 2000
37
US
I created an OCX using VB6. I put a picturebox (called graph) 4 textboxes and 1 command button (command1) on a form. I type numbers in the textboxes and then click on the command button.

The result is a graph grid in the picturebox.

See code below.

'=====================
Private Sub Command1_Click()
Xmin = Xmin.Text
Xmax = Xmax.Text
Ymin = Ymin.Text
Ymax = Ymax.Text
graph.Scale (Xmin, Ymax)-(Xmax, Ymin)
graph.Line (Xmin, 0)-(Xmax, 0)
graph.Line (0, Ymax)-(0, Ymin)
For H0 = Xmin To Xmax
For V0 = Ymin To Ymax
graph.Circle (H0, V0), 0.1
Next V0
Next H0
End Sub

'====================

I'm able to add this control in Word and after I type numbers in the textboxes and click command1 the graph appears in the picturebox.

Problem is, if I save, close the doc then reopen it, the graph is gone. The control is still there.

How can I change the code so that the graph is drawn on the doc and the control disappears?

Mathprof



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top