Click here to Skip to main content
16,006,749 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralExecuting an executable in the setup process Pin
xbiplav11-Jan-08 10:55
xbiplav11-Jan-08 10:55 
GeneralRe: Executing an executable in the setup process Pin
Dave Kreskowiak11-Jan-08 11:06
mveDave Kreskowiak11-Jan-08 11:06 
GeneralUsing the Selected value from a combo box in a database update Pin
AAGTHosting11-Jan-08 9:57
AAGTHosting11-Jan-08 9:57 
GeneralRe: Using the Selected value from a combo box in a database update Pin
Dave Kreskowiak11-Jan-08 10:33
mveDave Kreskowiak11-Jan-08 10:33 
GeneralChange Directory Pin
kermit88811-Jan-08 9:57
kermit88811-Jan-08 9:57 
GeneralRe: Change Directory Pin
Dave Kreskowiak11-Jan-08 10:31
mveDave Kreskowiak11-Jan-08 10:31 
GeneralRe: Change Directory Pin
kermit88811-Jan-08 10:42
kermit88811-Jan-08 10:42 
Generalcolor display in grid [modified] Pin
Member 476409411-Jan-08 2:58
Member 476409411-Jan-08 2:58 
How can i refresh datagrid in vb.net.
I want to display color in one cell in grid but when it loads first time it is working here is my code

Public Class Dialog_Colorazione
Const YEAR_START As Integer = 2005
'function to fill the combo with year
Private Sub LoadComboBoxes()
cboYear.Items.Clear()
cboYear.SelectedIndex = -1
Dim i As Integer
For i = Date.Today.Year To YEAR_START Step -1
cboYear.Items.Add(i.ToString())
Next
cboYear.SelectedIndex = 0
' loadcolor(cboYear.SelectedItem)
End Sub

'till here function to fill the combo with year

Private Sub Dialog_Colorazione_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'calling functions to fill the combo and display the color details
'cboYear.SelectedText = Today.Year

LoadComboBoxes()
' loadcolor(cboYear.SelectedItem)
'cboYear.SelectedIndex = 1
dgvFatturato.Refresh()

End Sub

'function the collect and fill the grid with the colors in the selected year
Public Function loadcolor(ByVal year As Integer)
Dim currentyear As Integer = Today.Year
Using connection As New OleDbConnection(My.Settings.BCS_ACCConnectionStrin g & ";Jet OLEDB:Database Password=" & Costanti.strAccessDbPassword)

connection.Open()

Dim adpt As New OleDb.OleDbDataAdapter("SELECT RefYear,LowRange,UpRange,ColorName FROM ACC_COLORI_FATTURATO WHERE RefYear=" & year & "", connection)

Dim ds As New DataTable

adpt.Fill(ds)

'added on 08/12/2007 to display color in the datagrid
If ds Is Nothing Or ds.Rows.Count = 0 Then
ShowMessage("Nessun dato per i criteri selezionati")
dgvFatturato.Visible = False
Else
dgvFatturato.DataSource = Nothing
dgvFatturato.Visible = True
dgvFatturato.DataSource = ds

ds.Columns(0).ColumnName = "Anno"
ds.Columns(1).ColumnName = "Maggiore da"
ds.Columns(2).ColumnName = "Minore da"
ds.Columns(3).ColumnName = "Colore"
' ds.Columns(4).ColumnName = "ID colore" 'commended on 11/01/2008 for hiding the coloumn

'Added on 11/01/2008
' Dim year1 As Integer = cboYear.SelectedItem
Using connection1 As New OleDbConnection(My.Settings.BCS_ACCConnectionStrin g & ";Jet OLEDB:Database Password=" & Costanti.strAccessDbPassword)
connection1.Open()
Dim ds1 As New DataTable
Dim adpt1 As New OleDbDataAdapter("select color from ACC_COLORI_FATTURATO WHERE RefYear=" & year & "", connection)
adpt1.Fill(ds1)
If dgvFatturato.RowCount > 0 And ds1.Rows.Count > 0 Then
For Each row As DataGridViewRow In dgvFatturato.Rows
' For i As Integer = 0 To ds1.Rows.Count - 1
Dim colorn As Integer = ds1.Rows(row.Index).Item(0)
row.Cells(3).Style.BackColor = Color.FromArgb(255, Color.FromArgb(CType(colorn, Int32)))
Next
End If
connection1.Close()
End Using
''Till here

End If
'Till here added on 08/12/2007 to display color in the datagrid

connection.Close()
End Using

End Function
'till here function the collect and fill the grid with the colors in the selected year

'to collect and display the color information on change of the combo
Private Sub cboYear_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cboYear.SelectedIndexChanged
loadcolor(cboYear.SelectedItem)
End Sub
'till here to collect and display the color information on change of the combo



Thanks....

modified on Friday, January 11, 2008 10:52:18 PM

GeneralRe: color display in grid Pin
Dave Kreskowiak11-Jan-08 3:54
mveDave Kreskowiak11-Jan-08 3:54 
GeneralRe: color display in grid Pin
Member 476409411-Jan-08 16:43
Member 476409411-Jan-08 16:43 
GeneralRe: color display in grid Pin
Dave Kreskowiak12-Jan-08 7:02
mveDave Kreskowiak12-Jan-08 7:02 
GeneralDoubt in DOS Pin
Senthil S11-Jan-08 2:25
Senthil S11-Jan-08 2:25 
GeneralRe: Doubt in DOS Pin
Paul Conrad11-Jan-08 2:31
professionalPaul Conrad11-Jan-08 2:31 
GeneralRe: Doubt in DOS Pin
Dave Kreskowiak11-Jan-08 3:19
mveDave Kreskowiak11-Jan-08 3:19 
Generalfind dotnet FrameWork Pin
Senthil S10-Jan-08 23:13
Senthil S10-Jan-08 23:13 
GeneralRe: find dotnet FrameWork Pin
Thomas Stockwell11-Jan-08 1:35
professionalThomas Stockwell11-Jan-08 1:35 
GeneralRe: find dotnet FrameWork Pin
Vimalsoft(Pty) Ltd11-Jan-08 3:09
professionalVimalsoft(Pty) Ltd11-Jan-08 3:09 
GeneralRe: find dotnet FrameWork Pin
Dave Doknjas11-Jan-08 12:42
Dave Doknjas11-Jan-08 12:42 
QuestionTime and date Pin
pshilpar10-Jan-08 22:32
pshilpar10-Jan-08 22:32 
GeneralRe: Time and date Pin
Dave Kreskowiak11-Jan-08 3:17
mveDave Kreskowiak11-Jan-08 3:17 
GeneralI would like to Understand this Generated SQL by the Adapter(Dave) Pin
Vimalsoft(Pty) Ltd10-Jan-08 20:55
professionalVimalsoft(Pty) Ltd10-Jan-08 20:55 
GeneralRe: I would like to Understand this Generated SQL by the Adapter(Dave) Pin
Dave Kreskowiak11-Jan-08 3:14
mveDave Kreskowiak11-Jan-08 3:14 
GeneralRe: I would like to Understand this Generated SQL by the Adapter(Dave) Pin
Vimalsoft(Pty) Ltd11-Jan-08 3:25
professionalVimalsoft(Pty) Ltd11-Jan-08 3:25 
GeneralHelp for file creation Pin
Senthil S10-Jan-08 20:08
Senthil S10-Jan-08 20:08 
GeneralRe: Help for file creation Pin
Nilesh Hapse10-Jan-08 21:37
Nilesh Hapse10-Jan-08 21:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.