love_lyn99
Member
- Joined
 - Sep 2, 2022
 
- Messages
 - 16
 
- Programming Experience
 - Beginner
 
Hi! I am creating a system where when i type a number in textbox1, it automatically add commas. ive searched in the internet and found almost similar functions on what i am looking for. but i have a problem, i dont want the < .00 > decimal to show during i enter the numbers and i will only add decimal if needed.
but some codes i found will only add < .00 > or not able to add decimal at all. here's the code im currently using:
	
	
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
i did put the <("n0") > because i want to not show the decimal, but instead it completely removes decimal (i think). the "." wont show.
i also tried the ("#,###,###") but it has the same result.
for example: val = 123456
output = 123,456
but if i add decimal: it wont show the "."
i add the 3rd line because i want the cursor to be fix at the end.
	
		
			
		
		
	
				
			but some codes i found will only add < .00 > or not able to add decimal at all. here's the code im currently using:
			
				TextBox1_TextChanged:
			
		
		
		Private Sub TextBox1_TextChanged(sender As Object, e As EventArgs) Handles TextBox1.TextChanged
        TextBox1.Text = CDbl(TextBox1.Text).ToString("n0")
        TextBox1.Select(TextBox1.Text.Length, 0)
End Sub
	i did put the <("n0") > because i want to not show the decimal, but instead it completely removes decimal (i think). the "." wont show.
i also tried the ("#,###,###") but it has the same result.
for example: val = 123456
output = 123,456
but if i add decimal: it wont show the "."
i add the 3rd line because i want the cursor to be fix at the end.