وعليكم السلام ورحمة الله وبركاته ،،،
جرب هذا الكود
جرب هذا الكود
كود :
Dim currentText As String = TextBox1.Text
Dim paddedText As String
Select Case currentText.Length
Case 1
paddedText = currentText.PadLeft(6, "0"c) ' Add 5 leading zeros
Case 2
paddedText = currentText.PadLeft(6, "0"c) ' Add 4 leading zeros
Case 3
paddedText = currentText.PadLeft(6, "0"c) ' Add 3 leading zeros
Case 4
paddedText = currentText.PadLeft(6, "0"c) ' Add 2 leading zeros
Case 5
paddedText = currentText.PadLeft(6, "0"c) ' Add 1 leading zeros
Case Else
paddedText = currentText ' No padding needed
End Select
TextBox1.Text = paddedText