|
You need to implement "double buffering".
I'm sure there's some VB6 code examples of double buffering somewhere on the Internet.
|
|
|
|
|
I just remembered a nice easy trick to get double buffering for free in VB6. I've never tried it with an animation before, so it might require some tweaking, but it's worth a shot.
Instead of drawing these lines on a form, draw them inside a PictureBox control. Let's call this control "picLines". Make sure to set Picturebox.AutoRedraw to FALSE in the designer. When you're ready to draw a line in your code, do this...
Private Sub DrawLines()
' Double buffer this draw.
picLines.AutoRedraw = True
' Clear picture box.
' (This part might not be necessary. Try playing around with this.)
picLines.Picture = Nothing
picLines.Cls
' Draw your lines here.
picLines.Line (0, 0) -Step(picLines.ScaleWidth, 0)
' End double buffering and draw it.
picLines.AutoRedraw = False
picLines.Picture = picLines.Image
End Sub
|
|
|
|
|
Thanx for your prompt reply Josh, I'll look into it.
|
|
|
|
|
Hi,
I have a ASP form which has a radio control for "yes/no", and in the SQL server I have a data type bit to store the value, but before inserting the values, how to I convert the value "yes and no" to bit data type.
Thanks,
abhi
abhi
|
|
|
|
|
Converting a yes/no to a bit....
Enum MyBool
YES = 0
NO = 1
End Enum
dim bValue as byte
bValue = Convert.ToByte(MyBool.YES)
Or you could use this method I put together for converting strings
Public Sub ConvertStringByte(ByVal stringVal As String)
' Convert the string to a char array
Dim chArray() As Char
chArray = stringVal.ToCharArray(0, stringVal.Length)
'Convert each char into a byte
Dim i As Short
Dim b As Byte
Dim byArray(stringVal.Length) As Byte
For i = 0 To chArray.Length - 1
b = System.Convert.ToByte(chArray(i))
byArray(i) = b
Next
'Write each value out and the entire bytes
For i = 0 To byArray.Length - 1
Console.Write(byArray(i).ToString() & ":")
Next
'Reconstruct the string value and print it
For i = 0 To byArray.Length - 1
Console.Write(Convert.ToChar(byArray(i)))
Next
End Sub
|
|
|
|
|
Hi everyone, I was wondering if anyone out there knows of an efficient method of populating a custom listview control. This listview will have about 60,000 rows with about 15 columns of data and inherits from the system listview control. The problem I am having is that my customer control class stores the table of data into a class variable datatable. This takes approx 2 secs, which isn't too bad. I then populate the listview from this table, which takes 45 seconds, which is way too long. Any help would be greatly appreciated. Thank you very much. Have a nice day.
My code to populate the listview is:
Dim i As Short
Dim str As String
Dim lvRange(pData.Rows.Count - 1) As ListViewItem
Me.BeginUpdate()
For i = 0 To pData.Rows.Count - 1
itmListItem = New ListViewItem
itmListItem.Text = Convert.ToString(pData.Rows(i).Item(myArrayList(0)))
For shtCntr = 1 To myArrayList.Count - 1
itmListItem.SubItems.Add(Convert.ToString(pData.Rows(i).Item(myArrayList(shtCntr))))
Next
lvRange(i) = itmListItem
'Me.Items.Add(itmListItem)
Next
Me.Items.AddRange(lvRange)
Me.EndUpdate()
eatwork
|
|
|
|
|
DON'T put 60.000 rows of anything in any sort of control
You mention that your control is a custom control. I advise that you find some way of paging the data. I recall that there are some good articles here on CP on paging that you could moderately easy tweak to suit your control.
"God doesn't play dice" - Albert Einstein
"God not only plays dice, He sometimes throws the dices where they cannot be seen" - Niels Bohr
|
|
|
|
|
Hi Mr.Larson,
Thank you for your response. I have begun recoding my form to only populate the listbox after an event has fired to limit the # of rows that will be populated. Thank you for your help.
eatwork
|
|
|
|
|
Hmmm... that's a tough one. It looks like your doing all the right things. You have your BeginUpdate() and EndUpdate().
Also, AddRange() is the fastest way to add items to your ListView. I measured this several months back, and AddRange() was about 20 times faster than individual calls to Add().
The ListView is really just a wrapper over Window's list control. Perhaps the thing to do is to make direct win32 calls via P/Invoke, which would avoid the overhead. However, the marshalling involved with doing P/Invokes adds overhead too. So that might not be fast enough either. (I don't think you can make unmarshalled/unmanaged calls to win32 libraries in unmanaged blocks in C#, but don't quote me on that.)
Of course, the easiest solution would be to add a progress control here. That is if you can get away with it.
|
|
|
|
|
Hi Mr.Quick,
THank you for your response. The reason I asked this was that I can add the records to a combobox via its datasource way faster and was curious if there was a method to add a datasource to a listbox in the same way to improve the performance. Thanks for your help.
eatwork
|
|
|
|
|
I'm a newby to mobile development and was needing a hand figuring out how to load images into a pictureBox control at runtime, I had originally solved the problem using an imageList but decided the constraint of having a uniform size for each image in the list was not even close to ideal.
Thanks a bundle in advance for your help.
BMW
|
|
|
|
|
i am trying to fetch the data for the crystal report at the runtime by
adding a crystal report viewer and ten givin
OleDbDataAdapter1.Fill(DataSet11)
DataGrid1.DataSource = DataSet11
Dim cr As New CrystalReport1()
cr.SetDataSource(DataSet11)
CrystalReportViewer1.ReportSource = cr
also i have created manuual connections , but no data is getting fetched in the report where as it is working fine vth a datagrid. What is the problem? also please help me in using parameterized qurries for crystal reports???/
|
|
|
|
|
i have created a datagrid on a windows form using vb.net. It is showing the data after retrival from a table. but now i have added a button --update changes and now i want that when the user changes anything in the datagrid it should get updated in the database. how can we do this?
|
|
|
|
|
Would like some code to find an image or a picture from a folder in the computer and place it on a form or an unbound object frame in Ms Access Application.
Thanks in advance.
Regards
Joseph
Joseph K. Mckenzie
|
|
|
|
|
I have a web form with 2 datagrids.
DataGrid1 has a few columns, the first of which is a button that, when clicked, causes DataGrid2 to be filled accordingly. The logic works fine.
Upon entry into the form, and immediately after filling DataGrid1, which will always have at least one row, I would like to "auto-click" the button in the first row.
How can I do this?
Bill
|
|
|
|
|
u mean when the from is loaded datagrid2 must b filled with the data that corresponds to the value of the first row of the datagrid1 right?
i am not sure but i think you can retrive the desired cell of the datagrid using the code:
datagrid1.item(rownumber,columnnumber)
using this write the query to fill the second grid at the form load event itself.
this is what i can think of. pls let me know if this works.
|
|
|
|
|
Your summary of what I was trying to do is correct.
This is what I found that works:
Dim button As Button = DataGrid1.SelectedItem.Cells(0).Controls(0)
varWhatever = button.Text
If I get the chance I will try your suggestion and get back to you
|
|
|
|
|
I have populated my datagrid and made some changed in our data now I want to save it to my database, don't have any idea how to? I am using dataset.
|
|
|
|
|
Hi guys!
need some help from u guys
can any one tell me how to add serial no in datagrid row header in vb.net datagrid as same as in sql2000 results pane when viewed in grid view ..
need it urgently.
bye.
abhinav
|
|
|
|
|
can u eloborate it a bit?
|
|
|
|
|
i'll try
actually i have a datagrid in one of my window form.
what actually i want is that when the data grid is populated there should be a serial no. before every row of grid
like we have column names in Column header property of datagrid.
is there any way to add serial no in row header property like it is in sql 2000 result pane when viewed in grid view with ctrl+d + f5 with any select statement.
abhinav
|
|
|
|
|
hello all,
this could be a stupid question. but for me it is a headache. i've been trying to do it for some time with no luck.
i have got a datagrid with some data. i want to write the code to send the rows of data directly into a table on the click event of a button. how is this possible. if anyone knows how please do help me.
thanks
|
|
|
|
|
First count the no of row in dataset
dim rowno as integer = dataset.row.count
for rowno = 0 to rowno 'creating a loop
dim strval as string=datagrid.items(row#,coloum1).tostring
dim insert as string = "insert into table(field)values(strval)'write the insert command here
cmd1 = new oldbcommdbuilder(insert)
cmd1.nonexecutereader
next
hope it helps you
If you still have any questions let me know i will give you detailed explanation.
take care
Regards
|
|
|
|
|
hi,
thanks for ur help. right now i am in another project team doing a project in asp.net. i will try out ur solution and let u know.
thanks,
lavanya
|
|
|
|
|
hellow to all ...
i wana to Bind to a Datagrid 2 tabels , i had used the JOIN Statment and the statment run fine ,
just when i wana bind the datagrid to the tabel i can't select 2 tabels at one to bind them .
i am useing this method to bind the tabel to a datagrid
Dim sqlMarkups As String
Dim ds1 As DataSet = New DataSet
Try
sqlMarkups = "The sql join statment"
Dim conSQL As New SqlClient.SqlConnection(sConn)
Dim daMarkups As New SqlClient.SqlDataAdapter(sqlMarkups, conSQL)
Dim dsMarkup As New DataSet
daMarkups.FillSchema(dsMarkup, SchemaType.Source, "tabel")
daMarkups.Fill(dsMarkup, "tabel")
grdComplaintlist.SetDataBinding(dsMarkup, "tabel")
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
thxx for any help ..
-- modified at 6:04 Thursday 1st December, 2005
|
|
|
|