Click here to Skip to main content
15,846,727 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,i have a gridview that displays user input data as 27734404647

how can i replace the 27 with 0

thank you
Posted
Updated 11-Jun-12 3:30am
v2

Hi Vtec16,
Here is the code-
VB
For RowsCount = 0 To DataGridView1.Rows.Count - 2
For Each dgvr As DataGridViewRow In DataGridView1.Rows
      dgrv.Cells(0).Value = dgvr.Cells(0).Value.ToString.Replace("Text","anothertext")
Next
  Next
 
Share this answer
 
Comments
Vtec16 11-Jun-12 8:30am    
awesome,it works,,thanks Javed
Jαved 11-Jun-12 9:35am    
Glad it helped.
text='Eval("fieldname").ToString().Replace("27","0")'
 
Share this answer
 
Comments
Vtec16 11-Jun-12 5:15am    
how would i put this in?
Vtec16 11-Jun-12 5:21am    
iv tried this.....if (BenMsisdnVal != "") ussdReport.Rec.BeneficiaryContactNumber.ToString().Replace("27", "0");

and its not doing anything
Get the cell value and then use simple string operations (replace, indexOf) to update this value.

Or else, you can do this when you setup your dataset (using queries).
 
Share this answer
 
Comments
Vtec16 11-Jun-12 5:18am    
Hi,Iv tried that as im using a datastore that was created as a standard programming procedure and im using optional parameters in my queries that has been set up in a seperate xml file,maybe im doing this wrong.please help

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900