AJUDA FLEXGRID

MARCELOFAZAN 26/07/2010 15:27:47
#348517
Pessoal minha primeira FlexGrid
Preciso de uma ajuda

consigo carregar sem erros no LOAD esse codigo

With MSFlexGrid1
.Rows = 1
.Cols = 5
.FixedCols = 0
.FormatString = [Ô]ID|TURMA|ALUNO|DATA|ENTRADA|SAIDA[Ô]
.ColWidth(0) = 400
.ColWidth(1) = 2000
.ColWidth(2) = 2000
.ColWidth(3) = 800
.ColWidth(4) = 800
.ColWidth(5) = 800
End With


Ai tambem ja tenho esse codigo Mais nao sei onde encaixar ele esta no load por enquanto

If Not rs.EOF Then
ID = rs!cod
TxtTurma.Text = rs!turma
Txtaluno.Text = rs!aluno
TxtData.Text = rs!Data
TxtEntrada.Text = rs!entrada
TxtSaida.Text = rs!saida
End If

e tambem faltam algum select ? e o que mais falta ?

A tabela do Recordset é a tabela da flexgrid quero ao carregar o formulario a mesma se mostre preenchida

obrigado
abs
Marcelo Fazan
ROBIU 26/07/2010 16:02:12
#348521
Resposta escolhida
Tenta Adaptar esse código para o seu projeto
Sub CarregarGrid()
Set Rs = New ADODB.Recordset [ô]Faz uma instância da classe Ado
Sql = [Ô]Select * From NomeTabela Order BY Aluno[Ô] [ô]Define um select
Rs.Open SqlOuTb, Cnn, adOpenKeyset, adLockPessimistic
With HGrid [ô]encurtar o código
If Rs.RecordCount > 0 Then
With HGrid
.Clear
.Rows = Rs.RecordCount + 1
Rs.MoveFirst
For i = 1 To Rs.RecordCount
If Rs(0) <> [Ô][Ô] Then .TextMatrix(i, 0) = Rs(0) [ô]Lancamento
If Rs(1) <> [Ô][Ô] Then .TextMatrix(i, 1) = Rs(1) [ô]Data
If Rs(2) <> [Ô][Ô] Then .TextMatrix(i, 2) = Rs(2) [ô]Conta
If Rs(3) <> Empty Then .TextMatrix(i, 3) = Rs(3) [ô]Hist
If Rs(4) <> Empty Then .TextMatrix(i, 4) = Rs(4)

Rs.MoveNext
Next i
End With
Else
.Clear
.Rows = 2
End If
End With
Rs.Close
Set Rs = Nothing
End Sub
MARCELOFAZAN 26/07/2010 16:23:45
#348523
olá amigo perfeito deu certo ,
Obrigado
Abs
Marcelo Fazan
Tópico encerrado , respostas não são mais permitidas