Ver Mensaje Individual
  #3 (permalink)  
Antiguo 10/07/2009, 17:55
Avatar de MeXiCaN
MeXiCaN
 
Fecha de Ingreso: mayo-2004
Ubicación: Barcelona - España , Morelia - México
Mensajes: 162
Antigüedad: 20 años, 8 meses
Puntos: 0
Respuesta: Invokerequired

Esto es lo que tengo y no funciona. Me da 2 errores

Error 1: InvokeRequired' is not a member of Magneto.Magneto_class.Up_datagrid'.

Error 2: Magneto.Magneto_class.Up_datagrid' is a delegate type and requires a single 'addressof' expression as the only argument to the constructor.

Cita:
Public Delegate Sub Up_datagrid(ByVal info)

Sub act_datagrid()

If (Up_datagrid.InvokeRequired) Then Error 1
BLI.Invoke(New Up_datagrid(act_datagrid)) Error 2
Else
Magneto.DataGridView1.Rows.Add(Info)
Magneto.DataGridView1.Refresh()
End If
End Sub
En el mismo archivo Magneto_class

//Esta es la función que llama el THREAD

Cita:
Sub cargar_TM()
Dim Fichero As String
Fichero = "C:\TM.log"
Magneto.DataGridView1.Columns.Add("Información", "Información")

Dim sr As System.IO.StreamReader = New System.IO.StreamReader(Fichero)
Dim Linea As String

Try
If (System.IO.File.Exists(Fichero) = True) Then
Do
Linea = sr.ReadLine()
Dim Linea_dividida As Array
If Linea = "" Then
GoTo alsalto
End If
Linea = Linea.Replace(" ", "")
Linea_dividida = Split(Linea, " ")
If ((Linea_dividida(2).ToString = "TMFIN") Then
MsgBox("la siguiente linea no es un TM")
Else
Info = Info & " " & Linea_dividida(2)
If Linea_dividida(2).ToString = "ENDTM" Then
Magneto.DataGridView1.Columns.Add("Información", "Información")
Info = Info & " " & Linea_dividida(2)
act_datagrid()
Info = ""
End If
End If
alsalto:
Loop Until Linea Is Nothing
MsgBox("Fichero acabado")
GoTo final
Else
MsgBox("El fichero " & Fichero.ToString & " no existe.")
End If
Catch E As Exception

End Try
final: Magneto.DataGridView1.Refresh()
sr.Close()

End Sub
Muchas gracias
__________________
Un saludo, MeXiCaN :golpeado: :adios:

Poco es tanto, cuando poco necesitas. E.Bunbury

Siempre que haya una causa noble por la que luchar, siempre habrá ladrones que la apoyarán.

Última edición por MeXiCaN; 11/07/2009 a las 17:45