|
Hi,
I have no experience with scrolling UserControls, I would not be surprised
if that turns out to be somewhat slow.
I tend to do complex stuff in a lightweight fashion, i.e. by drawing directly
onto the Panel, without any added Controls. It is not the easiest way, but
it gives full control on what gets done how and when, hence also maximum
performance. So if the UserControls are three instances of the same class,
I would consider to redo that class without using any internal Controls.
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
I'm not surprised it's slow. You're painting 93 controls, plus the panel on every scroll movement. I don't know why you need all these PictureBox controls (BTW: It's the most abused control by new programmers). Painting everything yourself on the Panel control, or some other container control that you write would give you FAR better performance.
|
|
|
|
|
Dave Kreskowiak wrote: (BTW: It's the most abused control by new programmers).
Amen, and half of them expect it to be Paint or Powerpoint....
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
In this code...There are 3 user controls(sections) Each section has a groupbox that contains a number of radio buttons and labels, a combobox, and a button. The requirement is to have a user preference kind of thing where the user can reorder the sections, remove, add etc. I had to put all 3 on a panel because the form has a toolbar and a statusbar and I need those controls to be scrollable without effecting the toolbar or statusbar. putting me.invalidate helped dramatically but it still is jumpy.
by you saying "painting everything yourself"...never have done this. how do you handle that?
thanks.
|
|
|
|
|
nlarson11 wrote: by you saying "painting everything yourself"...never have done this. how do you handle that?
I thought you were doing what most newbies do when putting a game together. Using PictureBox controls for tiles and sprites. You can't find a more inefficient method of doing a game.
Simply put, putting 100 controls on a form is not going to paint smoothly, no matter what you do. You can get a bit of an improvement by turning on double-buffering on the form, maybe even if you did it on the Panel control, but don't expect much. It's still going to be jumpy because of the shear number of controls.
|
|
|
|
|
hi i m working on a billing system.i am getting problem for the main billing page.i have given space for customer name.invoice no,date and two check boxes.1)wholsale rate and 2)normal rate.then i have given a list view to see what items he selected.there are two combo boxes 1)select product 2)Qty.
i want that when i select an item its details should automatically be entered in the list view.and after entering the qty total amount should be calculate.
but the problem i am facing is that its not entering the data in the list view.
plz help
|
|
|
|
|
You haven't provided any useful deatils about how your code works. From where is the ListView supposed to be filled?? Some database? Is it supposed to be filled in upon the click of something? ...? ...? You haven't told anything we can use to tell you what's wrong. Not even a code snippet...
|
|
|
|
|
I am cleaning my code (going through making comments and trying to see if there is a better way of doing things) and wanted to know if anyone could answer this.
In parts of my code I am reading from a file and need to temporarily save the data. Currently I have created some Structures. Is this the best practice or would it be better to do arrays or something else. The reason I picked Structures is because in my code I can easily see that str.Ticket means ticket. If I do an array like arrayString(4) does not tell me what I am grabbing.
Any comments? Thank you.
|
|
|
|
|
Cory Kimble wrote: In parts of my code I am reading from a file and need to temporarily save the data. Currently I have created some Structures. Is this the best practice or would it be better to do arrays or something else. The reason I picked Structures is because in my code I can easily see that str.Ticket means ticket. If I do an array like arrayString(4) does not tell me what I am grabbing.
I would have gone with a class and created a custom object to do this (easier to serialize the data, etc), but structure will do it trick too. Are you mainly worried about your application speed / performance or more worried about good coding practices?
Pete Soheil
DigiOz Multimedia
http://www.digioz.com
|
|
|
|
|
Both speed Perfomance and practices.
|
|
|
|
|
Cory Kimble wrote: Both speed Perfomance and practices.
In terms of speed I would say an array would probably be the fastest. In terms of best practices, the prefered way would probably be to create an object for it.
Pete Soheil
DigiOz Multimedia
http://www.digioz.com
|
|
|
|
|
Hi Cory,
Definitely classes and structures, and not heterogenous arrays.
The difference in performance would be only a couple of percent,
the difference in code readability is tremendous.
Once you have defined your classes/structures, if you need many of them.
put them together in either collections or arrays, depending on what kind
of operations you need. If arrays, these would be homogeneous arrays
(each element of the array has the same meaning).
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Hi every one,
I am developing a windows application which needs word and visio application to be embedded on to a form. I am using DSOFramer Active-X control to do the above.
My application reads data from the database (a BLOB Field - that contains the word or visio document) and creates a temporary file in the local directory and then opens that file using DSOFramer control. (http://support.microsoft.com/kb/311765)
All the manipulations are stored on the same temporary file and update the file contents on to that database (as BLOB).
It works fine most of the time but some times while saving the word document it through an exception - "the target of an invocation"
Inner Exception -System.Runtime.InteropServices.COMException (0x80030021): A lock violation has occurred.
This exception occurs while saving the document.
There is an even provided by DSOFramer control – ‘OnSaveCompleted’ which occurs on save completion.
After the file saved, I am opening the temporary file using IO.FileStream and reading the contents to byte() and updating the database with new binary data(BLOB Field)
I hope this explains wat I am trying to do.
Please could any one tell me where I am going wrong.
Thanks in advance
chirantan
|
|
|
|
|
I am trying to update a database in .net. When I created the data source .net copies the database in my project folder to the bin folder. Every time my application runs it copies the database. My application grabs the info and puts it in a dataset that has a filter (Only bring in records where column Loaded equals 'No') I then do a process and set certain records' columns to 'Yes'. When I fill the dataset again it is suppose to take off those records that I changed the columns to 'Yes'. It doesn't. When I look at my folders. The folder in the path of the build did not change. The other did. How do I get rid of one of these databases and make this work, without starting the datasource over?
Any ideas. I hope I explained this well enough.
Also, Why am I getting this error
'C:\Documents and Settings\walz-db.WALZEQ\My Documents\Visual Studio 2005\Projects\VS2005 InYardTrucks\bin\bin\myTest.mdb' is not a valid path. Make sure that the path name is spelled correctly and that you are connected to the server on which the file resides.
What do I need to change to fix?
-- modified at 10:01 Tuesday 28th August, 2007
|
|
|
|
|
You need to fix whatever code is generating that path string. Somehow, the bin folder has been added twice. We'd need to see the code that's putting this path string together.
|
|
|
|
|
Here is the only place I thing there might be something wrong but don't know how to fix.
When I call the fill:
Me.TransactionTableTableAdapter.Fill(Me.MyTestDataSet.TransactionTable)
It eventually gets to this code in the Settings.designer.vb file
<Global.System.Configuration.ApplicationScopedSettingAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Configuration.SpecialSettingAttribute(Global.System.Configuration.SpecialSetting.ConnectionString), _
Global.System.Configuration.DefaultSettingValueAttribute("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\myTest.mdb")> _
Public ReadOnly Property TestConnection() As String
Get
Return CType(Me("TestConnection"), String)
End Get
End Property
The truth is I don't have a TestConnection anymore. I have a dataBind to the myTest.mdb listed above. Is this my problem?
I will try to put everything here I think is pertinant to solve this problem.
Connection string: Provider=Microsoft.Jet.OLEDB.4.0;Data Source="C:\Documents and Settings\walz-db.WALZEQ\My Documents\Visual Studio 2005\Projects\VS2005 InYardTrucks\myTest.mdb"
datagrid = bindingsource
BindingSource = MytestDataSet
MytestDataSet has two adapters and two tables, one per adapter
I don't know what other lines of code you need.
|
|
|
|
|
Cory Kimble wrote: .SpecialSettingAttribute(Global.System.Configuration.SpecialSetting.ConnectionString), _ Global.System.Configuration.DefaultSettingValueAttribute("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\myTest.mdb")>
This says that if there is a ConnectionString, return it from the settings in your app's settings. If there is no setting available, return the DefaultSettingValue instead. Id' look in your app setting Project/Properties for a value for the connection string.
|
|
|
|
|
So, how do you suggest I solve my issue.
In folder C:\VS2005 InYardTrucks I have a database myDatabase(We will call it Database1). This is where I have the build go to. In C:\VS2005 InYardTrucks\bin there is a copy of myDatabase(We will call Database2). When I do a fill the dataset is filled with the Database1 data. When I update the dataset it writes it to Database2. So When I run the program again Database 1 overwrites anything in database2.
How do I fix? Where do I need to look to find the code that does this? Do I need to change my build location to the bin folder? Do I need to repost this to see if anyone knows?
Thanks.
I found the problem. the database had a output directory property set to 'Always copy' and I changed it to "Never copy'
Thank you.
-- modified at 11:50 Friday 31st August, 2007
|
|
|
|
|
I'm not seeing how this would cause the problem you described. I'm still wondering how you got a bin folder inside a bin folder in your project's directory structure.
|
|
|
|
|
hi
i want to do windows hook programming .i am a beginner and am not able to understand codes given as examples in internet.could any one give me a good example and reference links for doing hooks programming and api programming.
i have to record and replay the keboard and mouse events thats my main requirement.
with regards
Balagurunathan.B
|
|
|
|
|
The terms "beginner" and "windows hook" don't belong in the same paragraph, let alone the same sentance. Windows Hooks are an advanced topic, especailly the CBT hook that you're looking to use.
If you can't understand the stuff you've already found, pointing you to more links probably isn't going to help. Also, how are we going to be able to explain it to you in a much shorter forum post?
This article[^] is about the only one I've found that explains the hook and how to implement it in a managed class. If this goes over your head too, I have no idea how to explain it to you.
|
|
|
|
|
thanks for link .
with regards
Balagurunathan.B
|
|
|
|
|
hi All,
am creating an application to search the Grid, i master that in SQl db, no am using Access for this Application. i have an adapter , at the moment am using a Wizard. and i have this SQl statement that works fine when i run it in Query analyzer, but when i drop it in the Adapter it give the Following Error.
OleDbCommand.Prepare method requires all variable length parameters to have an explicitly set non-zero Size.
Here is an SQl statement in the adapter.
SELECT Actual_Extent, Boundary_Area, Compl_Boundary_Area, Current_Values, Extension, First_Prop_Address, Improved_Value, Improvements_Value, Lis_key, Num_key, Own_Name, Parcel_No, Parcel_Portion_No, Primary_ID, Prop_Address, Purchase_Date, Site_Value, Street_Name, Street_No, Title_Deed_No, Values_Effective FROM Property_ValRoll WHERE
(Boundary_Area = ?) AND
(SUBSTRING(Lis_key , 5 , 5) = ? )
This code is working fine only when i remove the substring search like this
SELECT Actual_Extent, Boundary_Area, Compl_Boundary_Area, Current_Values, Extension, First_Prop_Address, Improved_Value, Improvements_Value, Lis_key, Num_key, Own_Name, Parcel_No, Parcel_Portion_No, Primary_ID, Prop_Address, Purchase_Date, Site_Value, Street_Name, Street_No, Title_Deed_No, Values_Effective FROM Property_ValRoll WHERE
(Boundary_Area = ?) AND
(Lis_key = ? )
but i need to Search within the String. how can i achieve that.
thanks
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sudden your Face, but It sharpens your Understanding
|
|
|
|
|
Am replying to my POst, i have post this same thread in other Forum on the Net and i found that Access(Ole) does not support "substring", i replaced substring with the "mid" function and my adapter was perfectly created. Now from the above query in my adapter i have changed it to
SELECT Actual_Extent, Compl_Boundary_Area, Boundary_Area, Current_Values, Extension, Improved_Value, First_Prop_Address, Improvements_Value, Lis_key, Num_key, Own_Name, Parcel_No, Parcel_Portion_No, Primary_ID, Prop_Address, Purchase_Date, Site_Value, Street_Name, Street_No, Title_Deed_No, Values_Effective FROM Property_ValRoll WHERE (Boundary_Area = ?) AND (MID(Lis_key, 5, 5) = ?)
And now i have a Search button that will search the grid from a selection in the combobox and textbox. here is the code.
Dim strErrorMsg As String
Dim strerror As System.Data.SqlClient.SqlError
Try
damixed.SelectCommand.Parameters("Boundary_Area").Value = cmbboundary.Text
damixed.SelectCommand.Parameters("Lis_key").Value = txterf.Text
damixed.Fill(Dsmixed)
If Dsmixed.Tables("Property_ValRoll").Rows.Count = 0 Then
MessageBox.Show("Township was not found")
Else
Dsmixed.Clear()
damixed.Fill(Dsmixed)
DataGrid1.DataSource = Dsmixed
End If
Catch ExSQL As System.Data.SqlClient.SqlException
''''All this will trap all data Problems and Network if available
For Each strerror In ExSQL.Errors
Next
Select Case strerror.Number
Case 17
strErrorMsg = "Missing server"
Case 4060
strErrorMsg = "Missing database"
Case 18456
strErrorMsg = "Missing user name or password"
Case Else
strErrorMsg = strerror.Message
End Select
MessageBox.Show(strErrorMsg, "SQL Server Error: " & strerror.Number, MessageBoxButtons.OK, MessageBoxIcon.Error)
Catch ExcpInvOp As System.InvalidOperationException
MessageBox.Show("Close the connection first!", "Invalid Operation", MessageBoxButtons.OK, MessageBoxIcon.Error)
Catch Excp As System.Exception ' generic exception handler
MessageBox.Show(Excp.Message, "Unexpected Exception", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
When i try to search inserting anput into the textbox , i get the following Error
An OleDBParameter with Parametername 'Lis_key' is Not Containt by this OleDBParameterCollection
i have declared a separate adapter for the combobox "cmbboundary" ,with the following code in it.
SELECT DISTINCT Boundary_Area FROM Property_ValRoll ORDER BY Boundary_Area
What is Wrong with the Parameter that is complaining about
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sudden your Face, but It sharpens your Understanding
|
|
|
|
|
iam validating the textbox in lostfocus event but it is changing values for month to date and viceversa when the day is single digit.
this is the code iam using,please mail how to weite code for validating.thanks
Private Sub txtfromip_LostFocus()
If txtfromip.Text <> "" Then
On Error GoTo errtrap
If Not IsDate(Format(txtfromip.Text, "MM/dd/yyyy")) Then
MsgBox "Invalid Date. Enter Valid Date. Format is 'MM/dd/yyyy'", vbInformation
txtfromip.SetFocus
SendKeys "{home}+{end}"
Else
txtfromip.Text = Format(txtfromip.Text, "MM/dd/yyyy")
End If
Exit Sub
errtrap:
MsgBox Err.Description, vbCritical, "Error No:" & CStr(Err.Number)
Err.clear
End If
End Sub
|
|
|
|
|