Pease check whether its two space " " or one space " " After split check the size of array
-----Original Message----- From: [email protected] [mailto:[EMAIL PROTECTED] Behalf Of Nirmal Abraham Sent: Monday, June 27, 2005 5:23 PM To: [email protected] Subject: Re: [AspNetAnyQuestionIsOk] Split a line using array : From Nirmal Again the error : Index was outside the bounds of the array. Sub BindEdit() Dim rs As SqlDataReader Dim seals As String Dim con As New SqlConnection("database=bl;uid=sa;pwd=;server=lc2000") Dim Cmd As New SqlCommand("BL_view", con) Cmd.CommandType = CommandType.StoredProcedure With Cmd.Parameters .Add("@xRef_no1", txtRegno1.Text) End With con.Open() rs = Cmd.ExecuteReader() Session.LCID = 2057 If rs.Read Then seals = rs("SealNos") End If Dim strValue As String = Trim(seals) lblSeal1.Text = strValue.Split(" ")(0) lblSeal2.Text = strValue.Split(" ")(1) --Error : Index was outside the bounds of the array. lblSeal3.Text = strValue.Split(" ")(2) con.Close() rs.Close() End Sub Private Sub txtRegno1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtRegno1.TextChanged BindEdit() End Sub Please Help me sir ...................... --------------------------------------------------------- [EMAIL PROTECTED] wrote: lblSeal1.Text = strValue.Split("")(0) lblSeal2.Text = strValue.Split("")(1)--Error lblSeal3.Text = strValue.Split("")(2) Give Space lblSeal1.Text = strValue.Split(" ")(0) lblSeal2.Text = strValue.Split(" ")(1) lblSeal3.Text = strValue.Split(" ")(2) Nirmal Abraham <[EMAIL PROTECTED]> Sent by: [email protected] 06/27/2005 03:13 PM Please respond to AspNetAnyQuestionIsOk To: [email protected] cc: Subject: Re: [AspNetAnyQuestionIsOk] Split a line using array : From Nirmal [EMAIL PROTECTED] wrote: Dim strValue As String = Trim("12345 23456 34556 56777") Label1.text = Sval.Split(" ")(0) Label2.text = Sval.Split(" ")(1) Label3.text = Sval.Split(" ")(2) Label4.text = Sval.Split(" ")(3) write it more generic. ------------------------------------------------- Sub BindEdit() Dim rs As SqlDataReader Dim seals As String Dim con As New SqlConnection("database=bl;uid=sa;pwd=;server=lc2000") Dim Cmd As New SqlCommand("BL_view", con) Cmd.CommandType = CommandType.StoredProcedure With Cmd.Parameters .Add("@xRef_no1", txtRegno1.Text) End With con.Open() rs = Cmd.ExecuteReader() Session.LCID = 2057 If rs.Read Then seals = rs("SealNos")--Input(123 223 567) End If Dim strValue As String = Trim(seals) lblSeal1.Text = strValue.Split("")(0) lblSeal2.Text = strValue.Split("")(1)--Error lblSeal3.Text = strValue.Split("")(2) con.Close() rs.Close() End Sub Private Sub txtRegno1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtRegno1.TextChanged BindEdit() End Sub Nirmal Abraham <[EMAIL PROTECTED]> Sent by: [email protected] 06/27/2005 01:18 PM Please respond to AspNetAnyQuestionIsOk To: "ASP.NET" <[email protected]> cc: Subject: [AspNetAnyQuestionIsOk] Split a line using array : >From Nirmal I am having the seal No like ââ'¬Â 12345 23456 34556 56777 ââ'¬Â in the single line : LABEL.TEXT I want to split and put it in Label1.text = 12345 Label2.text = 23456 Label3.text = 34556 Label4.text = 56777 Please help me sir. --------------------------------- How much free photo storage do you get? Store your friends n family photos for FREE with Yahoo! Photos. http://in.photos.yahoo.com [Non-text portions of this message have been removed] Yahoo! Groups Links [Non-text portions of this message have been removed] --------------------------------- YAHOO! GROUPS LINKS Visit your group "AspNetAnyQuestionIsOk" on the web. To unsubscribe from this group, send an email to: [EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. --------------------------------- --------------------------------- Too much spam in your inbox? Yahoo! Mail gives you the best spam protection for FREE! http://in.mail.yahoo.com [Non-text portions of this message have been removed] Yahoo! Groups Links [Non-text portions of this message have been removed] --------------------------------- YAHOO! GROUPS LINKS Visit your group "AspNetAnyQuestionIsOk" on the web. To unsubscribe from this group, send an email to: [EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. --------------------------------- --------------------------------- Free antispam, antivirus and 1GB to save all your messages Only in Yahoo! Mail: http://in.mail.yahoo.com [Non-text portions of this message have been removed] Yahoo! Groups Links This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message. Any unauthorised review, use, disclosure, dissemination, forwarding, printing or copying of this email or any action taken in reliance on this e-mail is strictly prohibited and may be unlawful. Visit us at http://www.cognizant.com Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
