Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
.netfactory
#1
Solved: 11 Years, 4 Months ago
Hi all,
I want to write some instructions within the form,I can create form and radiobutton,textboxes but how to write my instructions?

Code:
Set MainForm = DotNetFactory.CreateInstance("System.Windows.Forms.Form", "System.Windows.Forms")
Set TextField = DotNetFactory.CreateInstance("System.Windows.Forms.TextBox", "System.Windows.Forms")
Set Button = DotNetFactory.CreateInstance("System.Windows.Forms.Button", "System.Windows.Forms")
Set objPosition = DotNetFactory.CreateInstance("System.Drawing.Point","System.Drawing",x,y)

what about writing inthe form itself?
Reply
#2
Solved: 11 Years, 4 Months ago
You will have to use Label class for that. In the example below- you will find the use of Label to add the instructions to a Form
Code:
Set MyForm = DotNetFactory.CreateInstance("System.Windows.Forms.Form", "System.Windows.Forms")  
Set MyText = DotNetFactory.CreateInstance("System.Windows.Forms.TextBox", "System.Windows.Forms")  
Set MyButton = DotNetFactory.CreateInstance("System.Windows.Forms.Button", "System.Windows.Forms")  
Set MyLabel = DotNetFactory.CreateInstance("System.Windows.Forms.Label", "System.Windows.Forms")  
Set Pos = DotNetFactory.CreateInstance("System.Drawing.Point","System.Drawing",x,y)  

MyLabel.Text = "Please enter some text into the text box below and click on close button"
MyLabel.AutoSize = True

Pos.X = 90  
Pos.Y = 100  
MyText.Location = Pos  
MyText.Width = 100  

Pos.X = 100  
Pos.Y = 130  
MyButton.Location = Pos  
MyButton.Text = "Close"

MyForm.Controls.Add MyLabel
MyForm.Controls.Add MyText  
MyForm.Controls.Add MyButton  
MyForm.CancelButton = MyButton  

MyForm.ShowDialog  

Msgbox MyText.Text  

Set MyText = Nothing
Set MyButton = Nothing
Set Pos = Nothing
Set MyForm = Nothing

hope that helps.

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)