dezinh20 Posted May 21, 2012 at 04:03 PM Report #457188 Posted May 21, 2012 at 04:03 PM (edited) Olá, estou tentando inserir na primeira coluna uma imagem de anexo.... Dim figuras As Image = My.Resources.Anexo1 myService = New DataTable SQL = "SELECT * FROM user_clianexo right join cli_cadastro on user_clianexo.idcli_cadastro = cli_cadastro.idcli_cadastro" IDados(SQL, myService) For i = 0 To myService.Rows.Count - 1 MS.Item(0, 1).Value = figuras Next MS.DataSource = myService mas não estou conseguindo.. tem como alguém me da uma luz, como que eu coloco uma imagem do datagridview Edited May 21, 2012 at 04:14 PM by Caça GeSHi
Caça Posted May 21, 2012 at 04:15 PM Report #457191 Posted May 21, 2012 at 04:15 PM Para preencher por DataSource a imagem já tem de ir no teu DataTable, será melhor adicionares uma coluna ao teu DataTable dpois de ser carregado com os dados da BD e adicionar a imagem a essa coluna. Pedro Martins Não respondo a duvidas por PM
dezinh20 Posted May 21, 2012 at 05:48 PM Author Report #457226 Posted May 21, 2012 at 05:48 PM também pensei nessa hipótese, mas não sei mexer em nada, no DataTable... =/
dezinh20 Posted May 21, 2012 at 08:28 PM Author Report #457249 Posted May 21, 2012 at 08:28 PM eu consegui fazer isso Dim img As New DataGridViewImageColumn() Dim inImg As Image = Image.FromFile("Image Path") img.Image = inImg DataGridView1.Columns.Add(img) img.HeaderText = "Image" img.Name = "img" mas existe linhas que não podem aparecer o desenho, como que eu faço !?
dezinh20 Posted May 22, 2012 at 05:30 PM Author Report #457437 Posted May 22, 2012 at 05:30 PM MS.DataSource = myService MS.Columns.Add("Anexos", "Anexos") img.Name = "img" valor = myService.Rows.Count - 1 For i = 1 To valor If myService.Rows(i).Item(4).ToString <> Nothing Then img.Image = inImg MS.Rows(i).Cells("Anexos").Value = img.Image End If Next consegui fazer ele criar uma coluna e adicionar a imagem, mas ele não carrega a imagem.. alguém sabe o motivo? ou como faço para carregar a imagem...
Blackvelvet Posted May 22, 2012 at 05:32 PM Report #457440 Posted May 22, 2012 at 05:32 PM Sugestão: Porque não convertes a imagem em binario?
dezinh20 Posted May 22, 2012 at 05:41 PM Author Report #457442 Posted May 22, 2012 at 05:41 PM 😕 porque não sei ... Dim img As New DataGridViewImageColumn() Dim inImg As Image = My.Resources.Anexo1 MS.Columns.Add(img) img.Name = "img" valor = myService.Rows.Count - 1 For i = 1 To valor If myService.Rows(i).Item(4).ToString <> Nothing Then img.Image = inImg Else End If Next assim ele mostra as imagens, mas não pula a linha que eu desejo ex... eu quero essa imagem na linha 1,,2..4..5 e a linha 3 não... mas fazendo dessa forma ( conforme o código a cima) ele preenche em todos e não pula qual desejo
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