Click here to Skip to main content
15,891,938 members

Response to: little help needed in this problem vb 2010

Revision 4
Hi,

Try this:
VB
Private Sub KryptonButton1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles KryptonButton1.Click
	Dim i As Integer = 0
	Dim l As Integer = 0
	Dim lcn As String = ""
	If String.IsNullOrEmpty(textBox4.Text) AndAlso String.IsNullOrEmpty(textBox5.Text) AndAlso String.IsNullOrEmpty(textBox6.Text) Then
		MessageBox.Show("Please Enter Date of Birth!!!")
		Return
	End If
	Dim dateOfBirthWithoutSpaces As String = (TextBox4.Text + TextBox5.Text + TextBox6.Text).Replace(" ", "")
	For Each c As Char In dateOfBirthWithoutSpaces
		i += (Convert.ToInt32(c.ToString()))
	Next
	lcn = i.ToString()
	While lcn.Length > 1
		l = 0
		For Each c As Char In lcn
			l += (Convert.ToInt32(c.ToString()))
		Next
		lcn = l.ToString()
	End While
	TextBox7.Text = lcn
End Sub

Hope this helps.
Posted 28-Dec-12 5:44am by Thomas Daniels.
Tags: