Principiante VBNET
Publicado por Oscar (13 intervenciones) el 30/10/2007 17:42:06
Un saludo a todos bueno soy programador en VB6 y me estoy actualizando a visual basic .NET tengo la coneccon a una base de datos y funciona bien leo las tablas pero a la hora de llenar el Herachical Flex Grid tengo lios si alguien me pudiera decir cualquier forma de llenar el grid se lo agradeseria mucho
en visual basic yo utilizava lo siguiente
set rs = New ADODB.Recordset
set MSHF01.DataSource = Rs
y en visual 6 me llenaba sin mucho ajetreo
mi conexion esta bien pero cuando quiero llenar el grid ni con la propiedad TextMatrix se puede como al inicio lo hacia con visual basic 6 si alguien sabe cualquieera de las dos formas de llenar un grid ya sea con el
set MSHF01.DataSource = Rs
o con la propiedad TextMatrix
TextMatrix( Row , COl ) = Rs!NomCliente
que antes yo lo usaba en vb6
El codigo dijitado con problemas es el siguiente:
Public Class FrmComisiones
Private sSQL As String
Private Cmd As OleDb.OleDbCommand = Cn.CreateCommand()
Private Sub FrmComisiones_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim I As Integer = 1
sSQL = " SELECT Invoice,Invoice_Type,Business_Unit,Bill_To_Cust_Id" _
& " ,Sales_Person ,Accounting_dt,Account " _
& " FROM Ps_Bi_Hdr "
' WHERE RowNum < 1000
Cmd.CommandText = sSQL
Dim Lector As OleDb.OleDbDataReader = Cmd.ExecuteReader()
' Me.MSHFFactComiciones.DataSource = Lector
If Lector.Read() Then
' mostramos cada una de las tres columnas
I = I + 1
With Me.MSHFFactComiciones
'.get_TextMatrix(I, 1) = Str(I)
'.get_TextMatrix(I, 2) = "D"
'.set_TextMatrix(I, 1) = I
'.set_TextMatrix(I, 2) = "D"
.Rows = I
.Text = Lector.GetString(1)
'.Row = I : .Col = 2 : .Text = Lector.GetString(2)
'.Row = I : .Col = 3 : .Text = Lector.GetString(3)
'.Row = I : .Col = 4 : .Text = Lector.GetString(4)
'.Row = I : .Col = 5 : .Text = Lector.GetString(5)
' De ninguna opcion me funciona o puedo llenar el dicho Grid
End With
End If
Lector.Close() ' Cerramos el lector
End Sub
End Class
en visual basic yo utilizava lo siguiente
set rs = New ADODB.Recordset
set MSHF01.DataSource = Rs
y en visual 6 me llenaba sin mucho ajetreo
mi conexion esta bien pero cuando quiero llenar el grid ni con la propiedad TextMatrix se puede como al inicio lo hacia con visual basic 6 si alguien sabe cualquieera de las dos formas de llenar un grid ya sea con el
set MSHF01.DataSource = Rs
o con la propiedad TextMatrix
TextMatrix( Row , COl ) = Rs!NomCliente
que antes yo lo usaba en vb6
El codigo dijitado con problemas es el siguiente:
Public Class FrmComisiones
Private sSQL As String
Private Cmd As OleDb.OleDbCommand = Cn.CreateCommand()
Private Sub FrmComisiones_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim I As Integer = 1
sSQL = " SELECT Invoice,Invoice_Type,Business_Unit,Bill_To_Cust_Id" _
& " ,Sales_Person ,Accounting_dt,Account " _
& " FROM Ps_Bi_Hdr "
' WHERE RowNum < 1000
Cmd.CommandText = sSQL
Dim Lector As OleDb.OleDbDataReader = Cmd.ExecuteReader()
' Me.MSHFFactComiciones.DataSource = Lector
If Lector.Read() Then
' mostramos cada una de las tres columnas
I = I + 1
With Me.MSHFFactComiciones
'.get_TextMatrix(I, 1) = Str(I)
'.get_TextMatrix(I, 2) = "D"
'.set_TextMatrix(I, 1) = I
'.set_TextMatrix(I, 2) = "D"
.Rows = I
.Text = Lector.GetString(1)
'.Row = I : .Col = 2 : .Text = Lector.GetString(2)
'.Row = I : .Col = 3 : .Text = Lector.GetString(3)
'.Row = I : .Col = 4 : .Text = Lector.GetString(4)
'.Row = I : .Col = 5 : .Text = Lector.GetString(5)
' De ninguna opcion me funciona o puedo llenar el dicho Grid
End With
End If
Lector.Close() ' Cerramos el lector
End Sub
End Class
Valora esta pregunta


0