Numbered textbox? - Vb.net

Do you need something made? then ask in here.
Forum rules
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
21 posts Page 2 of 3
Contributors
User avatar
Usman55
VIP - Site Partner
VIP - Site Partner
Posts: 2821
Joined: Thu Dec 24, 2009 7:52 pm

Re: Numbered textbox? - Vb.net
Usman55
I tried both of them again and yes, one of them is for vb.net but its code is too long. I'll ask MTech what he used in his notepad.
Image
User avatar
Livengood
Serious Programmer
Serious Programmer
Posts: 445
Joined: Tue Feb 16, 2010 6:24 am

Re: Numbered textbox? - Vb.net
Livengood
Usman55 wrote:
I tried both of them again and yes, one of them is for vb.net but its code is too long. I'll ask MTech what he used in his notepad.
lol, that one it wont let me open ;), vb.net 6?
Image
User avatar
code it
VIP - Site Partner
VIP - Site Partner
Posts: 821
Joined: Sun Oct 10, 2010 3:02 pm

Re: Numbered textbox? - Vb.net
code it
Livengood wrote:
Axel wrote:
http://www.codeproject.com/KB/cpp/linen ... r_rtb.aspx for richtextbox(It auto resizes, when you zoom for example
For a normal textbox, just use the listbox method

also this is a nice one
http://www.codeproject.com/KB/edit/numberedtextbox.aspx

These all are not in visual basic.. ones in C# and another idk..
Converted the code but dunno if it is right or works
Your Code Has Arrived! wrote:
Code: Select all
Private Sub updateNumberLabel()
	'we get index of first visible char and 

	'number of first visible line

	Dim pos As New Point(0, 0)
	Dim firstIndex As Integer = richTextBox1.GetCharIndexFromPosition(pos)
	Dim firstLine As Integer = richTextBox1.GetLineFromCharIndex(firstIndex)

	'now we get index of last visible char 

	'and number of last visible line

	pos.X = ClientRectangle.Width
	pos.Y = ClientRectangle.Height
	Dim lastIndex As Integer = richTextBox1.GetCharIndexFromPosition(pos)
	Dim lastLine As Integer = richTextBox1.GetLineFromCharIndex(lastIndex)

	'this is point position of last visible char, we'll 

	'use its Y value for calculating numberLabel size

	pos = richTextBox1.GetPositionFromCharIndex(lastIndex)

	'finally, renumber label

	numberLabel.Text = ""
	For i As Integer = firstLine To lastLine + 1
		numberLabel.Text += i + 1 & vbLf
	Next

End Sub
User avatar
Usman55
VIP - Site Partner
VIP - Site Partner
Posts: 2821
Joined: Thu Dec 24, 2009 7:52 pm

Re: Numbered textbox? - Vb.net
Usman55
Is that the complete code?
Image
User avatar
MrBrockWalker
VIP - Donator
VIP - Donator
Posts: 171
Joined: Mon Jul 05, 2010 10:30 am

Re: Numbered textbox? - Vb.net
MrBrockWalker
You could use this control I used back in the 2008 version, it wont work in the 2010 version for me :( But here's a link: http://scintillanet.codeplex.com/
Visit BW Photography and check out my photos!
User avatar
Axel
Coding God
Coding God
Posts: 1928
Joined: Sun Jun 27, 2010 9:15 pm

Re: Numbered textbox? - Vb.net
Axel
Usman55 wrote:
Axel, I tried both the links but they don't seem to work. They are not compatible with .net I guess.
What? Thats bullshit haha :P
Livengood wrote:
Axel wrote:
http://www.codeproject.com/KB/cpp/linen ... r_rtb.aspx for richtextbox(It auto resizes, when you zoom for example
For a normal textbox, just use the listbox method

also this is a nice one
http://www.codeproject.com/KB/edit/numberedtextbox.aspx

These all are not in visual basic.. ones in C# and another idk..
Well you can compile them in C# as a .dll file and use them in vb (make sure the framework version of the textbox is equal to or lower than your application framework)
http://vagex.com/?ref=25000
User avatar
code it
VIP - Site Partner
VIP - Site Partner
Posts: 821
Joined: Sun Oct 10, 2010 3:02 pm

Re: Numbered textbox? - Vb.net
code it
yeah you can but dont you have c# ?
User avatar
Axel
Coding God
Coding God
Posts: 1928
Joined: Sun Jun 27, 2010 9:15 pm

Re: Numbered textbox? - Vb.net
Axel
code it wrote:
yeah you can but dont you have c# ?
I have C# yes...
http://vagex.com/?ref=25000
User avatar
Livengood
Serious Programmer
Serious Programmer
Posts: 445
Joined: Tue Feb 16, 2010 6:24 am

Re: Numbered textbox? - Vb.net
Livengood
MrBrockWalker wrote:
You could use this control I used back in the 2008 version, it wont work in the 2010 version for me :( But here's a link: http://scintillanet.codeplex.com/
lol im using vb 10
Image
User avatar
Usman55
VIP - Site Partner
VIP - Site Partner
Posts: 2821
Joined: Thu Dec 24, 2009 7:52 pm

Re: Numbered textbox? - Vb.net
Usman55
It supports 2010 too and it has support for .Net Framework 4.0 as well.
Image
21 posts Page 2 of 3
Return to “Tutorial Requests”