473,666 Members | 2,047 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

refresh performance in datagrid - big problem

sp
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 cells - they are generated through the
odswierz_frekfe ncje() 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_frekfe ncje()

If status = True Then

' Me.DataGridView 1.BeginEdit(Fal se)

Dim miesiac, rok, liczba_dni As Integer

miesiac = Me.DateTimePick er1.Value.Month

rok = Me.DateTimePick er1.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(r ok / 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 DataGridViewBut tonColumn

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
button.

.UseColumnTextF orButtonValue = True

End With



id_klasy = klasa.SelectedV alue.row.id_kla sy

With DataGridView1

.Rows.Clear()

.Columns.Clear( )

.Columns.Add("n r_dziennik", "Numer w dzienniku")

.Columns("nr_dz iennik").Defaul tCellStyle.Font = New
Font("Courier", 12, FontStyle.Bold, GraphicsUnit.Pi xel)

.Columns("nr_dz iennik").Width = 50

.Columns("nr_dz iennik").AutoSi zeMode =
DataGridViewAut oSizeColumnMode .None

.Columns("nr_dz iennik").SortMo de =
DataGridViewCol umnSortMode.Not Sortable

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

.Columns("uczen ").AutoSize Mode =
DataGridViewAut oSizeColumnMode .AllCells

.Columns("uczen ").DefaultCellS tyle.Font = New
Font("Verdana", 12, FontStyle.Under line, GraphicsUnit.Pi xel)

.Columns("uczen ").DefaultCellS tyle.Alignment =
DataGridViewCon tentAlignment.M iddleLeft

.Columns("uczen ").SortMode =
DataGridViewCol umnSortMode.Not Sortable

.Columns.Add("i d_ucznia", "id ucznia")

.Columns("id_uc znia").Visible = False

.Columns("id_uc znia").SortMode =
DataGridViewCol umnSortMode.Not Sortable

.Columns.Add("i d_klasy", "id klasy")

.Columns("id_kl asy").Visible = False

.Columns("id_kl asy").SortMode =
DataGridViewCol umnSortMode.Not Sortable

.Columns.Add(bu ttonColumn)

.Columns("dodaj ").Visible = False

.Columns("dodaj ").SortMode =
DataGridViewCol umnSortMode.Not Sortable

.Rows.Add()

.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(St r(j), Str(j))

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

.Columns(Str(j) ).DefaultCellSt yle.Alignment =
DataGridViewCon tentAlignment.M iddleCenter

.Columns(Str(j) ).SortMode =
DataGridViewCol umnSortMode.Not Sortable

.Rows(0).Cells( j + 4).Style.BackCo lor =
My.Settings.Ite m("dtyg_B_" + Trim(Str(Weekda y(Str(miesiac) + "/" +
Str(j) + "/" + Str(rok)))))

.Rows(0).Cells( j + 4).Style.ForeCo lor =
My.Settings.Ite m("dtyg_F_" + Trim(Str(Weekda y(Str(miesiac) + "/" +
Str(j) + "/" + Str(rok)))))

.Rows(0).Cells( j + 4).Value =
My.Settings.Ite m("dtyg_" + Trim(Str(Weekda y(Str(miesiac) + "/" + Str(j)
+ "/" + Str(rok)))))

Next

End With

vuczniowieBindi ngSource.Filter = "id_klasy=' " +
Str(id_klasy) + "'"

vuczniowieBindi ngSource.Sort = "nr_dzienni k"

liczba_ocen = 0

Try
Me.Pobierz_frek fencjeTableAdap ter.Fill(Me.Bli zej_szkolyDataS et.pobierz_frek fencje,
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.Exceptio n

blad.pokaz(ex.M essage)

End Try

For i = 0 To vuczniowieBindi ngSource.Count - 1

id_ucznia = vuczniowieBindi ngSource.Item(i ).row.id_ucznia

With DataGridView1

.Rows.Add()

.Rows(i + 1).Cells(0).Val ue =
vuczniowieBindi ngSource.Item(i ).row.nr_dzienn ik

.Rows(i + 1).Cells(1).Val ue =
vuczniowieBindi ngSource.Item(i ).row.uczen

.Rows(i + 1).Cells(2).Val ue = id_ucznia

.Rows(i + 1).Cells(3).Val ue = id_klasy

End With

'MsgBox(Pobierz _ocenyBindingSo urce.Count)

Me.frekfencjaBi ndingSource1.Fi lter = "id_ucznia= '" +
Str(id_ucznia) + "'"

For j = 0 To Me.frekfencjaBi ndingSource1.Co unt - 1

With frekfencjaBindi ngSource1.Item( j).row

If .spoznienie = True Then

DataGridView1.R ows(i + 1).Cells(.liczb a_dni
+ 4).Value = "S"

If .status 0 Then

DataGridView1.R ows(i +
1).Cells(.liczb a_dni + 4).Style.BackCo lor =
My.Settings.fre k_spoznienie_po szlo

Else

DataGridView1.R ows(i +
1).Cells(.liczb a_dni + 4).Style.BackCo lor = My.Settings.fre k_spoznienie

End If

Else

If .ilosc_godzin 0 Then

Try

DataGridView1.R ows(i +
1).Cells(.liczb a_dni + 4).Value += .ilosc_godzin

Catch ex As Exception

DataGridView1.R ows(i +
1).Cells(.liczb a_dni + 4).Value = .ilosc_godzin

End Try

Else

DataGridView1.R ows(i + 1).Cells(.liczb a_dni
+ 4).Value = "X"

End If

If .usprawiedliwio na = True Then

If .status 0 Then

DataGridView1.R ows(i +
1).Cells(.liczb a_dni + 4).Style.BackCo lor = My.Settings.fre k_nobecny_poszl o

Else

DataGridView1.R ows(i +
1).Cells(.liczb a_dni + 4).Style.BackCo lor = My.Settings.fre k_nobecny

End If

Else

If .status 0 Then

DataGridView1.R ows(i +
1).Cells(.liczb a_dni + 4).Style.BackCo lor = My.Settings.fre k_nnobecny_posz lo

Else

DataGridView1.R ows(i +
1).Cells(.liczb a_dni + 4).Style.BackCo lor = My.Settings.fre k_nnobecny

End If

End If

End If



End With

Next

Next

id_ucznia = -1

Try


Me.Pobierz_frek fencje_txtTable Adapter.Fill(Me .Blizej_szkolyD ataSet.pobierz_ frekfencje_txt,
New System.Nullable (Of Integer)(CType( id_ucznia, Integer)), miesiac, rok)

Catch ex As System.Exceptio n

blad.pokaz(ex.M essage)

End Try

Me.DataGridView 1.Visible = True

End If

End Sub
Jul 11 '06 #1
1 2587
Hi,

I have added a reply to you in microsoft.publi c.dotnet.langua ges.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

1
1973
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 order to get information for, everything is updated with the new data except the cell in the grid that was selected. This behavior does not occur when a table style is not applied to the datagrid. How do I refresh the datagrid so that the cell in...
0
1980
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 in a database (Sql Server 2000). I want to automatic update the datagrid when new new posts arrives in the table. Before the datagird is updated, the choosen index from the
1
3252
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 page ... there are couple of methods to do this which i know ... 1. Using Frames ... problem is gird will disappear and then redrawn on the page which i dont want. 2. Using XMLHTTP ... problem is i cant find any samples in .Net. so if any one of...
1
1916
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) so after the change the datagrid does'nt refresh the image because her name did not change. My question is : Is there a way to "refresh" the datagrid after the edit function, to refresh the image ?
7
15438
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 the file to a folder, and then I read it back into the dataset using the dataset1.readxml. Up to this point, everything works wonderfully. The query executes, the dataset gets populated, and I get the results displayed in the datagrid.
0
1307
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 be able to reload the datagrid or refresh the contents of the datagrid. Problem is that when I refresh the dataset it also refreshes the other table. How can I reload...refresh the datagrid without using the dataset object.
10
30665
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 to call DsStudentCourse1.Tables("SchYrSemCourseJoin").Clear() SqlDataAdapter3.Fill(DsStudentCourse1) However, the fill method causes a lot of time to process.
2
4561
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 cell or move the scrollbar of the datagrid... :(
5
2148
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 cells - they are generated through the odswierz_frekfencje() function (listed below)-
0
8356
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8783
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8552
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8640
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6198
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5666
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4198
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2773
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1776
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.