Hitmanpt 1 Posted January 21, 2011 Report Share Posted January 21, 2011 Boas pessoal... bem eu tenho este codigo Dim dbloc As String = INIAPI.INI.Read(Application.StartupPath & "\config.ini", "db", "location", "C:\DataBase1.accdb") con = New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & dbloc & ";Persist Security Info=False") Dim da As New OleDbDataAdapter("SELECT [frn],[lsn],[entered],[lde] FROM gymusers", con) Dim dt As New DataTable da.Fill(dt) dt.Columns(0).ColumnName = "Primeiro Nome" dt.Columns(1).ColumnName = "Apelido" dt.Columns(2).ColumnName = "Já entrou..." dt.Columns(3).ColumnName = "Limite de entradas" DataGrid1.DataSource = dt da.Dispose() con.Close() E quero que o programa ao carregar os valores para a DataGridView altere os valores iguais a 1000000000000000 para Livre... mas nao que as altere na base de dados... Alguma ideia? Link to post Share on other sites
Andrepereira9 4 Posted January 21, 2011 Report Share Posted January 21, 2011 boas Experimenta isto no evento CellFormatting, do DataGrid. Este exemplo vai percorrer todas as colunas existentes, mas se quiseres so determinda coluna tiras ciclo for, e onde esta o 'i', metes o numero da coluna Private Sub DataGrid1_CellFormatting(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellFormattingEventArgs) Handles DataGrid1.CellFormatting For i As Integer = 0 To DataGrid1.ColumnCount If e.ColumnIndex = i Then If e.Value = "1000000000000000" Then e.Value = "Livre" End If End If Next End Sub A informática chegou para resolver problemas que antes não existiam Quem ri por último é porque está conectado a 52 Kbs. Link to post Share on other sites
Hitmanpt 1 Posted January 21, 2011 Author Report Share Posted January 21, 2011 Obrigado Funcionou a 100% Link to post Share on other sites
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now