Hola que tal, ya expuse mi problema en el post
http://www.forosdelweb.com/s/msg201591.html
RootK (perdona que sea tan pesado, pero la solución que me diste no me ha funcionado)
Cita: Esta es la solución que me diste RootK
For Each c As Control In Me.Controls
If InStr(LCase(c.GetType.ToString), "textbox ") > 0 Then
c.Text = Replace(c.text,"´","'",1, CompareMethod.Text)
End If
Next
Me sale subrayado el "c.Text" y cuando situo el ratón encima para ver el error me sale;
"Text" no es un miembro de System.Web.UI.Control"
Al principio pensé que como el textbox que tengo es un WebControl tal vez funcionaria con cambiar
Código:
For Each c As Control In Me.Controls
por
For Each c As WebControl In Me.WebControls
Pero no, porque ahora lo que me subraya es "Me.WebControls" y me dice que WebControls no es miembro de WebApplication.Form1
Pongo un extracto del Codigo por si veis algo que se me haya pasado:
Código:
Imports System.Data
Imports System.Data.SqlClient
Imports System.Web.Security
Public Class Form1
Inherits System.Web.UI.Page
Protected WithEvents Label1 As System.Web.UI.WebControls.Label
Protected WithEvents Label2 As System.Web.UI.WebControls.Label
Protected WithEvents BtnEntrar As System.Web.UI.WebControls.Button
Protected WithEvents TextBox1 As System.Web.UI.WebControls.TextBox
Protected WithEvents TextBox2 As System.Web.UI.WebControls.TextBox
Protected WithEvents MsgBox1 As MsgBox.MsgBox
#Region " Código generado por el Diseñador de Web Forms "
'El Diseñador de Web Forms requiere esta llamada.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
End Sub
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: el Diseñador de Web Forms requiere esta llamada de método
'No lo modifique con el editor de código.
InitializeComponent()
End Sub
#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Introducir aquí el código de usuario para inicializar la página
Dim cn As SqlConnection
cn = New SqlConnection("data source=Server;initial catalog=DB1;persist security info=False;user id=User1; password=pass")
cn.Open()
End Sub
Private Sub BtnEntrar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnEntrar.Click
For Each c As WebControl In Me.webControls
If InStr(LCase(c.GetType.ToString), "textbox ") > 0 Then
c.Text = Replace(c.text, "´", "'", 1, CompareMethod.Text)
End If
Next
response.redirect("Form2.aspx",True)
End Sub
End Class
También he probado con
Código:
For i=0 to me.controls.count -1
If me.controls(i).getType.tostring=System.web.Ui.WebControls.TextBox then
Me.controls(i).text= Replace(Me.controls(i).text, "´", "'", 1, CompareMethod.Text)
pero nada de Nada.
¿Se os ocurre alguna otra forma?
Gracias a todos.
Sqlu2
P.D:Yo sigo buscando la manera, si por casualidad doy con ella, ya lo posteo aquí para todos.