0
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtsearch.Click

Dim SearchData = Search.StoredProcedure4(txtsearch.Text)
DataGridView1.DataSource = SearchData

End Sub

Conversion from string "&search" to type 'Integer' is not valid... How can I convert string into integer?

user2771704
  • 5,994
  • 6
  • 37
  • 38
jepoy
  • 173
  • 2
  • 2
  • 8

3 Answers3

1
Dim SearchData = Search.StoredProcedure4(txtsearch.Text)
int SearchDataInt = Convert.ToInt32(SearchData ) //or (int)SearchData 
DataGridView1.DataSource = SearchDataInt

Just add this line between your define and display.

BorHunter
  • 893
  • 3
  • 18
  • 44
  • hey, where should i put this one? can you cite an example? – jepoy Jan 30 '14 at 06:28
  • Please don't simply post the code. Give some explanation or information or usage about your code. For example, see [this answer](http://stackoverflow.com/a/16893057/756941). – Nazik Jan 30 '14 at 06:49
0
string s = "&search";
foreach( char c in s)
{
Console.WriteLine(System.Convert.ToInt32(c));
}
Pradeep D G
  • 55
  • 1
  • 4
0

Isn't the fault that you have extracted the wrong value? &search look like a parameter name in an URL, not the parameter value.

int.TryParse(stringValue, out intValue) is the way to go for parsing a string as an integer.

Frode Nilsen
  • 167
  • 2
  • 11