473,226 Members | 1,359 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,226 software developers and data experts.

refresh performance in datagrid - big problem


I have a problem with the refresh performance in datagrid –

when datagrid is being shown it is so slow that I can see one by one
cells is drawn

-datagrid contains about 35x40 of cells - they are generated through the
odswierz_frekfencje() function (listed below)-

-other datagrid – showing data from datasets are ok

-I suppose I have made some mistakes, could you give me a hint? which?
Sorry for crosspost!
Public Sub odswierz_frekfencje()

If status = True Then

' Me.DataGridView1.BeginEdit(False)

Dim miesiac, rok, liczba_dni As Integer

miesiac = Me.DateTimePicker1.Value.Month

rok = Me.DateTimePicker1.Value.Year

If miesiac = 1 Or miesiac = 3 Or miesiac = 5 Or miesiac = 7
Or miesiac = 8 Or miesiac = 10 Or miesiac = 12 Then

liczba_dni = 31

End If

If miesiac = 4 Or miesiac = 6 Or miesiac = 9 Or miesiac =
11 Then

liczba_dni = 30

End If

If miesiac = 2 And rok / 4 <Math.Floor(rok / 4) Then

liczba_dni = 28

End If

If miesiac = 2 And rok / 4 = Math.Floor(rok / 4) Then

liczba_dni = 29

End If

Dim id_klasy, id_ucznia, i, j, liczba_ocen As Integer

'Dim pozycje() = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}

Dim buttonColumn As New DataGridViewButtonColumn

With buttonColumn

.HeaderText = "Dodaj:"

.Name = "dodaj"

.Text = "Dodaj:"

' Use the Text property for the button text for all
cells rather

' than using each cell's value as the text for its own

.UseColumnTextForButtonValue = True

End With

id_klasy = klasa.SelectedValue.row.id_klasy

With DataGridView1



.Columns.Add("nr_dziennik", "Numer w dzienniku")

.Columns("nr_dziennik").DefaultCellStyle.Font = New
Font("Courier", 12, FontStyle.Bold, GraphicsUnit.Pixel)

.Columns("nr_dziennik").Width = 50

.Columns("nr_dziennik").AutoSizeMode =

.Columns("nr_dziennik").SortMode =

.Columns.Add("uczen", "uczen")

.Columns("uczen").AutoSizeMode =

.Columns("uczen").DefaultCellStyle.Font = New
Font("Verdana", 12, FontStyle.Underline, GraphicsUnit.Pixel)

.Columns("uczen").DefaultCellStyle.Alignment =

.Columns("uczen").SortMode =

.Columns.Add("id_ucznia", "id ucznia")

.Columns("id_ucznia").Visible = False

.Columns("id_ucznia").SortMode =

.Columns.Add("id_klasy", "id klasy")

.Columns("id_klasy").Visible = False

.Columns("id_klasy").SortMode =


.Columns("dodaj").Visible = False

.Columns("dodaj").SortMode =


.Rows(0).Cells(0).ReadOnly = True

.Rows(0).Cells(1).ReadOnly = True

.Rows(0).Cells(2).ReadOnly = True

.Rows(0).Cells(3).ReadOnly = True

For j = 1 To liczba_dni

.Columns.Add(Str(j), Str(j))

.Columns(Str(j)).Width = 28

.Columns(Str(j)).DefaultCellStyle.Alignment =

.Columns(Str(j)).SortMode =

.Rows(0).Cells(j + 4).Style.BackColor =
My.Settings.Item("dtyg_B_" + Trim(Str(Weekday(Str(miesiac) + "/" +
Str(j) + "/" + Str(rok)))))

.Rows(0).Cells(j + 4).Style.ForeColor =
My.Settings.Item("dtyg_F_" + Trim(Str(Weekday(Str(miesiac) + "/" +
Str(j) + "/" + Str(rok)))))

.Rows(0).Cells(j + 4).Value =
My.Settings.Item("dtyg_" + Trim(Str(Weekday(Str(miesiac) + "/" + Str(j)
+ "/" + Str(rok)))))


End With

vuczniowieBindingSource.Filter = "id_klasy='" +
Str(id_klasy) + "'"

vuczniowieBindingSource.Sort = "nr_dziennik"

liczba_ocen = 0

Me.Pobierz_frekfencjeTableAdapter.Fill(Me.Blizej_s zkolyDataSet.pobierz_frekfencje,
New System.Nullable(Of Integer)(CType(id_klasy, Integer)), New
System.Nullable(Of Integer)(CType(miesiac, Integer)), New
System.Nullable(Of Integer)(CType(rok, Integer)))

Catch ex As System.Exception


End Try

For i = 0 To vuczniowieBindingSource.Count - 1

id_ucznia = vuczniowieBindingSource.Item(i).row.id_ucznia

With DataGridView1


.Rows(i + 1).Cells(0).Value =

.Rows(i + 1).Cells(1).Value =

.Rows(i + 1).Cells(2).Value = id_ucznia

.Rows(i + 1).Cells(3).Value = id_klasy

End With


Me.frekfencjaBindingSource1.Filter = "id_ucznia='" +
Str(id_ucznia) + "'"

For j = 0 To Me.frekfencjaBindingSource1.Count - 1

With frekfencjaBindingSource1.Item(j).row

If .spoznienie = True Then

DataGridView1.Rows(i + 1).Cells(.liczba_dni
+ 4).Value = "S"

If .status 0 Then

DataGridView1.Rows(i +
1).Cells(.liczba_dni + 4).Style.BackColor =


DataGridView1.Rows(i +
1).Cells(.liczba_dni + 4).Style.BackColor = My.Settings.frek_spoznienie

End If


If .ilosc_godzin 0 Then


DataGridView1.Rows(i +
1).Cells(.liczba_dni + 4).Value += .ilosc_godzin

Catch ex As Exception

DataGridView1.Rows(i +
1).Cells(.liczba_dni + 4).Value = .ilosc_godzin

End Try


DataGridView1.Rows(i + 1).Cells(.liczba_dni
+ 4).Value = "X"

End If

If .usprawiedliwiona = True Then

If .status 0 Then

DataGridView1.Rows(i +
1).Cells(.liczba_dni + 4).Style.BackColor = My.Settings.frek_nobecny_poszlo


DataGridView1.Rows(i +
1).Cells(.liczba_dni + 4).Style.BackColor = My.Settings.frek_nobecny

End If


If .status 0 Then

DataGridView1.Rows(i +
1).Cells(.liczba_dni + 4).Style.BackColor = My.Settings.frek_nnobecny_poszlo


DataGridView1.Rows(i +
1).Cells(.liczba_dni + 4).Style.BackColor = My.Settings.frek_nnobecny

End If

End If

End If

End With



id_ucznia = -1


Me.Pobierz_frekfencje_txtTableAdapter.Fill(Me.Bliz ej_szkolyDataSet.pobierz_frekfencje_txt,
New System.Nullable(Of Integer)(CType(id_ucznia, Integer)), miesiac, rok)

Catch ex As System.Exception


End Try

Me.DataGridView1.Visible = True

End If

End Sub
Jul 11 '06 #1
1 2557

I have added a reply to you in microsoft.public.dotnet.languages.vb
newsgroup, please check it there. Thanks.

Best regards,
Jeffrey Tan
Microsoft Online Community Support
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
This posting is provided "AS IS" with no warranties, and confers no rights.

Jul 12 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

by: Shawn Benson | last post by:
I have a Windows form where a user enters an order number which returns a dataset that is bound to a datagrid. The problem is when a user clicks on a cell in the datagrid, then enters another...
by: Marcus | last post by:
Hello! I'm buildning a webpage in ASP.NET using Visual Basic. The page contains a datagrid, a dropdownlist, some textboxes and a couple of buttons. The datagrid displays barcodes from a table...
by: aliansari | last post by:
HI ... i am facing a problem while refreshing my datagrid ... i am developing a "Real time/Live data Stocks Trading Screen" ... what i want is to refresh my datagrid without refreshing the whole...
by: Andre | last post by:
hi, In my Datagrid i have some text and a image (for each item), if i edit the image and save it to the HD there's no problem, but the image is always saved with the same name (item number.jpg)...
by: Juan Romero | last post by:
Hey guys, please HELP I am going nuts with the datagrid control. I cannot get the damn control to refresh. I am using soap to get information from a web service. I have an XML writer output...
by: Erik | last post by:
I have a Form that has 2 OleDbAdapters and one dataset object. In the dataset I have two tables that are joined. My datagrid is looking at one table. I add new records to the datagrid. I want to...
by: jaYPee | last post by:
I have a function that call a stored procedure which performs an insert command. now i want to refresh the dataset so that the newly inserted data will be available to my datagrid I have tried...
by: Dan | last post by:
Hi, I have a Datagrid in a simple form that I programmatically modify using something like that : Me.DataGrid1(RowID, ColID) = "blablabla" But my cell wont refresh unless I click on another...
by: sp | last post by:
Hello I have a problem with the refresh performance in datagrid – when datagrid is being shown it is so slow that I can see one by one cells is drawn -datagrid contains about 35x40 of...
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.