Ihave this code so when you press a button it generates a text box
But i wanted to ad vb script to the text box what property would i do that with?Code:Dim txt As New TextBox
txt.AllowDrop = True
txt.Multiline = True
Me.Controls.Add(txt)
Printable View
Ihave this code so when you press a button it generates a text box
But i wanted to ad vb script to the text box what property would i do that with?Code:Dim txt As New TextBox
txt.AllowDrop = True
txt.Multiline = True
Me.Controls.Add(txt)
i don't understand the question...
can you explain exactly what you're trying to do?
I have a button that creates a text box but i want it to create a drag gable text box. How would id do that?
My visual basic 2010 was not abel to open it.
why not? what was the error?
It just said it was not abel to read it.
the 3 different versions have been downloaded 435 times in total + you're the first who can't open it
ok. different method:
vb Code:
Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim tb As New TextBox Me.Controls.Add(tb) AddHandler tb.MouseMove, AddressOf tb_MouseMove End Sub Private Const WM_NCLBUTTONDOWN As Integer = &HA1 Private Const HTCAPTION As Integer = 2 Private Sub tb_MouseMove(ByVal sender As System.Object, ByVal e As MouseEventArgs) Dim tb As TextBox = DirectCast(sender, TextBox) tb.Capture = False Dim m As Message = Message.Create(tb.Handle, WM_NCLBUTTONDOWN, New IntPtr(HTCAPTION), IntPtr.Zero) MyBase.DefWndProc(m) End Sub End Class
I also tried doing it with a rich text box but it is not moving
Code:Private Sub ToolStripButton3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton3.Click
Dim tb1 As New RichTextBox
Me.Controls.Add(tb1)
AddHandler tb1.MouseMove, AddressOf tb1_MouseMove
End Sub
Private Const WM_NCLBUTTONDOWN1 As Integer = &HA1
Private Const HTCAPTION1 As Integer = 21
Private Sub tb1_MouseMove(ByVal sender As System.Object, ByVal e As MouseEventArgs)
Dim tb1 As RichTextBox = DirectCast(sender, RichTextBox)
tb1.Capture = False
Dim m1 As Message = Message.Create(tb1.Handle, WM_NCLBUTTONDOWN1, New IntPtr(HTCAPTION1), IntPtr.Zero)
MyBase.DefWndProc(m1)
End Sub
HTCAPTION1 should be 2, not 21