PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197
Getting Alt + 0141 () in results-VBForums
Results 1 to 5 of 5

Thread: Getting Alt + 0141 () in results

  1. #1

    Thread Starter
    Addicted Member condonethis's Avatar
    Join Date
    Apr 2010
    Location
    TX
    Posts
    133

    Question Getting Alt + 0141 () in results

    I built a phonebook app and a backend to for modifying entries. The problem occurs when I attempt to edit an existing entry I get the Alt box character in my listbox for the search, or my textbox for modifying. I've tried different combinations of multiline, singleline.

    Thanks!
    Attached Images Attached Images  
    Attached Files Attached Files

  2. #2

    Thread Starter
    Addicted Member condonethis's Avatar
    Join Date
    Apr 2010
    Location
    TX
    Posts
    133

    Re: Getting Alt + 0141 () in results

    all fields in database set to nvar(255)

    if relative.

  3. #3

    Thread Starter
    Addicted Member condonethis's Avatar
    Join Date
    Apr 2010
    Location
    TX
    Posts
    133

    Lightbulb Re: Getting Alt + 0141 () in results

    I have noticed that the issue is caused by the Find function of the backend application. Upon new entry no issue, find after new insert and then there are all kinds of added spacing characters to the result from database in the single-line textbox. Although multiline textboxes do not show these characters they are still there.

    Last edited by condonethis; Jun 4th, 2011 at 12:35 PM.

  4. #4

    Thread Starter
    Addicted Member condonethis's Avatar
    Join Date
    Apr 2010
    Location
    TX
    Posts
    133

    Re: Getting Alt + 0141 () in results

    Solved the problem by using regex.replace(string, "[ \t\r\n]", "")

    vb Code:
    1. Public Function updatevalue(ByVal value, ByVal txtvalue) As Boolean
    2.         Dim ra As Integer
    3.         Dim thatline As String = txtvalue.text.ToString
    4.         thatline = System.Text.RegularExpressions.Regex.Replace(thatline, "[ \t\r\n]", "")
    5.         Dim command = New SqlCommand("Update PhoneNumbers Set " & value & "='" & thatline & "' WHERE LastName = '" & TxtLastName.Text _
    6.                              & "' AND Firstname = '" & TxtFirstName.Text & "'", sqlphonebook.con)
    7.         If sqlphonebook.con.State = ConnectionState.Closed Then
    8.             sqlphonebook.con.Open()
    9.         End If
    10.         ra = command.ExecuteNonQuery()
    11.         sqlphonebook.con.Close()
    12.     End Function
    13.     Public Function getvalue(ByVal field1, ByVal field2, ByVal put, ByVal sqlput) As Boolean
    14.         'Creating a read of the database
    15.         Dim results As New System.Text.StringBuilder
    16.         Dim thatline1 As String
    17.  
    18.         Dim command1 As New SqlCommand("SELECT rtrim(" & sqlput & ") FROM PhoneNumbers WHERE LastName = '" & field1.Text.ToString & "' AND Firstname = '" & field2.Text.ToString & "'", sqlphonebook.con)
    19.  
    20.  
    21.         'MsgBox(field1.ToString + Environment.NewLine + columnname + Environment.NewLine + put.ToString + Environment.NewLine + sqlput + Environment.NewLine + Environment.NewLine + command1.ToString)
    22.         ' AND PerformingDate = (SELECT MAX(PerformingDate) FROM leadlog WHERE LeadTitle = '" & field.Text & "'
    23.  
    24.         If sqlphonebook.con.State = ConnectionState.Closed Then
    25.             sqlphonebook.con.Open()
    26.         End If
    27.         Dim r As IAsyncResult = command1.BeginExecuteReader
    28.  
    29.         Dim reader As SqlDataReader = command1.EndExecuteReader(r)
    30.         While reader.Read
    31.             For i As Integer = 0 To reader.FieldCount - 1
    32.                 results.Append(reader(i).ToString & vbTab)
    33.             Next
    34.             results.Append(Environment.NewLine + Environment.NewLine)
    35.         End While
    36.         reader.Close()
    37.         command1.Connection.Close()
    38.         thatline1 = results.ToString
    39.         thatline1 = System.Text.RegularExpressions.Regex.Replace(thatline1, "[ \t\r\n]", "")
    40.  
    41.         put.Text = thatline1
    42.     End Function

  5. #5

    Thread Starter
    Addicted Member condonethis's Avatar
    Join Date
    Apr 2010
    Location
    TX
    Posts
    133

    Re: Getting Alt + 0141 () in results

    Obvious error is obvious now...

    vb Code:
    1. Public Function updatevalue(ByVal value, ByVal txtvalue) As Boolean
    2.         Dim ra As Integer
    3.         Dim thatline As String = txtvalue.text.ToString
    4.         thatline = System.Text.RegularExpressions.Regex.Replace(thatline, "[ \t\r\n]", "")
    5.         Dim command = New SqlCommand("Update PhoneNumbers Set " & value & "='" & thatline & "' WHERE LastName = '" & TxtLastName.Text _
    6.                              & "' AND Firstname = '" & TxtFirstName.Text & "'", sqlphonebook.con)
    7.         If sqlphonebook.con.State = ConnectionState.Closed Then
    8.             sqlphonebook.con.Open()
    9.         End If
    10.         ra = command.ExecuteNonQuery()
    11.         sqlphonebook.con.Close()
    12.     End Function
    13.     Public Function getvalue(ByVal field1, ByVal field2, ByVal put, ByVal sqlput) As Boolean
    14.         'Creating a read of the database
    15.         Dim results As New System.Text.StringBuilder
    16.         Dim thatline1 As String
    17.  
    18.         Dim command1 As New SqlCommand("SELECT rtrim(" & sqlput & ") FROM PhoneNumbers WHERE LastName = '" & field1.Text.ToString & "' AND Firstname = '" & field2.Text.ToString & "'", sqlphonebook.con)
    19.  
    20.  
    21.         'MsgBox(field1.ToString + Environment.NewLine + columnname + Environment.NewLine + put.ToString + Environment.NewLine + sqlput + Environment.NewLine + Environment.NewLine + command1.ToString)
    22.         ' AND PerformingDate = (SELECT MAX(PerformingDate) FROM leadlog WHERE LeadTitle = '" & field.Text & "'
    23.  
    24.         If sqlphonebook.con.State = ConnectionState.Closed Then
    25.             sqlphonebook.con.Open()
    26.         End If
    27.         Dim r As IAsyncResult = command1.BeginExecuteReader
    28.  
    29.         Dim reader As SqlDataReader = command1.EndExecuteReader(r)
    30.         While reader.Read
    31.             For i As Integer = 0 To reader.FieldCount - 1
    32.                 results.Append(reader(i).ToString [B]& vbTab[/B])
    33.             Next
    34. '---------->results.Append(Environment.NewLine + Environment.NewLine)
    35.         End While
    36.         reader.Close()
    37.         command1.Connection.Close()
    38.         thatline1 = results.ToString
    39.         thatline1 = System.Text.RegularExpressions.Regex.Replace(thatline1, "[ \t\r\n]", "")
    40.  
    41.         put.Text = thatline1
    42.     End Function
    [/QUOTE]

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width