|
Yes, Christian, it is! That's why I've been using a delegate... and the funny thing is that it worked as long as I had used everything in the same form, i.e. before changing everything to MDI.
The delegate's called from a function running in a BackgroundWorker, the code is
Private Sub CollectFrames(ByVal bgw As BackgroundWorker, ByVal Handler As ShowProgressDelegate)
StartMeasuring()
FramesCollected = My.Settings.MAXFRAMES
If FramesCollected > Me.DPXList.Count Then FramesCollected = Me.DPXList.Count
' create the array class for the frames
Frames = New clsFrames(FramesCollected)
Dim ExecutionTime As Integer = 0
For i As Integer = 0 To Me.FramesCollected - 1
Frames.Add(Me.DPXList.Item(i))
If i = 0 Then BGWFileRead.ReportProgress(1)
Dim thisFrame As clsDPX = Frames.getFrame(i)
ExecutionTime = GetCurrentMillisecondCount - GetPreviousMillisecondCount
If Handler IsNot Nothing Then
Dim ProcessMessage As String = (String.Format("Processing File {0} ({1} of {2})", thisFrame.FileToRead.Name, i.ToString, FramesCollected.ToString))
Handler.Invoke(CLng(FramesCollected), CLng(i), thisFrame.FileToRead.Name, ProcessMessage, ExecutionTime)
End If
Next
End Sub
Private Sub BGWFileRead_DoWork(ByVal sender As Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles BGWFileRead.DoWork
CollectFrames(BGWFileRead, AddressOf ShowProgress)
End Sub
Would you think that somewhere there is the hidden reason why the MDI parent form doesn't update? I guess I'll have to leave the problem for a while and find some sleep, it's 3:30 here...
|
|
|
|
|
This kind of invoke does not cause your controls to be accessed from the GUI thread.
What your need is myControl.Invoke(...) which guarantees the method called gets executed by the GUI thread, and that is the only way to keep your GUI healthy.
[EDIT]
I don't have any VB examples available, I have lots of C# examples though if you're interested.
I have a little article[^] which I just updated so it now contains examples in both C# and VB.NET
[/EDIT]
modified on Saturday, September 5, 2009 4:59 PM
|
|
|
|
|
I have a Menu Control that I populate dynamically and resize based off selections.
The resizing is an issue and is very sloppy, so I figured I would SuspendLayout(), change the width of my control and ResumeLayout()
For some reason whenever I call SuspendLayout(), my control's width is never changed.
Is there something I'm missing?
Example Code:
Some side notes: An initial SuspendLayout() call applies to the Menu control, but not it's children or controls embedded within the Menu children.
'assume i is the new width to set controls width to.
Dim o As System.Windows.Forms.Control
For Each o In _collection
'o.SuspendLayout()
o.Width = i
'o.ResumeLayout()
Next
'this loop only applies to children within Menu control, not controls within controls.
For Each o In Me.Controls
'o.SuspendLayout()
o.Width = i
'o.ResumeLayout()
Next
Me.Width = i
Me.Parent.Width = i
ControlArea.Width = i
If I uncomment o.SuspendLayout() and o.ResumeLayout() my o.Width = i seems pretty much ignored.
Any ideas?
|
|
|
|
|
The only thing I can think of, and then only because I have seen it in the InitializeComponent method, is:
o.ResumeLayout(false);
o.PerformLayout();
I know nothing!
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
You hide your Barcelonian accent pretty well, at least in writing.
|
|
|
|
|
Si Senor!
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
so you're a fake after all, a real Manuel would write "¡Si Senor!" as exclamation and question marks also appear upside down before the sentence.
|
|
|
|
|
¡No he aprendido cómo hacer eso todavía!
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
¡Usted todavía tiene que aprender mucho!
|
|
|
|
|
Ése es el sino de nosotros todo, si somos afortunados.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
El destino real es la más aprendemos, más nos damos cuenta de que no saben nada (como usted ha dicho antes).
|
|
|
|
|
¡Verdad, verdad! Mein Herr.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
I don't know about the width bit, but i would move the suspend and resume operations to outside the loop, only need to do them once each, rather than for every control being modified in the loop.
|
|
|
|
|
Hi,
IMO the Suspend/ResumeLayout is useful for controls holding lots of data (such as a TreeView), so you can modify its content step by step without it being recalculated every time.
Now if you want to modify dimensions of a collection of controls, it is their container you would have to tell not to recalculate itself all the time.
|
|
|
|
|
I have a database in which I put data by using ADO.
The database is .mdb
When i run the sub which puts the data in the database everything goes fine.
I add about 30k rows.
But when i run the same sub again,ie when i update the database, it tries to put the data, but in that data some old data is also present
and there comes a msgbox saying that duplicate entries and much more.
How to avoid this?
one more Q:
the size of the mdb file reaches to 50MB.
is there a way to have the size less?
TheMrProgrammer
http://www.icbse.com/2009/funny-exam-answers-school-students
http://download.cnet.com/TheCalcMan/3000-2094_4-10958266.html
|
|
|
|
|
TheMrProgrammer wrote: But when i run the same sub again,ie when i update the database, it tries to put the data, but in that data some old data is also present
and there comes a msgbox saying that duplicate entries and much more.
Without seeing the relevant parts of your code, any one who attempts an answer is simply guessing.
TheMrProgrammer wrote: one more Q:
the size of the mdb file reaches to 50MB.
is there a way to have the size less?
Again without knowing more about the Database it is almost impossible to tender a cogent reply.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
We're going to need more information to help you. How are you adding these records. What error messages are you getting? Are you using a DataAdapter or just straight insert commands? Are your tables constrained to be unique?
Also,
TheMrProgrammer wrote: one more Q:
the size of the mdb file reaches to 50MB.
is there a way to have the size less?
Access database files will retain their size even after records have been deleted. (If you had a .mdb file with thousands of records, then deleted the records, the .mdb file will still be very large in size.) If this is what you are referring to, Yes. You can reclaim what is no longer being used by the file. I think I used one of these articles[^] when I needed to accomplish this goal.
Hope this helps.
|
|
|
|
|
well....
partially you were correct to guess.
what you suggested was not the Q i asked.
But I am glad for the links of these articles.
Thanks.
My initial problem is solved.
It was a case of index.
Let me explain my 2nd Q.
Suppose i have new database D.
In it i write about 20 MB of data.
so the size of D is 20 MB.
What I wish is compress D so the 20MB reduces to a less value.
Is it possible?
TheMrProgrammer
http://www.icbse.com/2009/funny-exam-answers-school-students
http://download.cnet.com/TheCalcMan/3000-2094_4-10958266.html
|
|
|
|
|
You can create a zip file. Here are some articles[^] about how to do that in code. But I'm not sure this is exactly what you are looking for either. In order to use a zipped file you'd have to convert it back to the file type it was before, which would increase it back to it's original size as well. But if you are looking to compress it as a means of archiving or backing up this may work for you.
Good luck!
|
|
|
|
|
I suspect that you are not clearing or reinitialising the variables holding the data after the data is added to your database, therefore some of the data would be written to the database again, on subsequent writes to the database.
Steve Jowett
-------------------------
Real programmers don't comment their code. If it was hard to write, it should be hard to read.
|
|
|
|
|
No No
This was not the case.
thanks anyway for trying to help.
TheMrProgrammer
http://www.icbse.com/2009/funny-exam-answers-school-students
http://download.cnet.com/TheCalcMan/3000-2094_4-10958266.html
|
|
|
|
|
Hi all,
I have a little problem and I hope to find some help:
I'm developing a program (C.F.2-V.B.)that have multiple forms.
I need that when I switch from Form1 to Form2, I can continuing to use some of controls builded in Form1.
For example, if in Form1 I have a ComboBox1 populated with its appropiate items, when I switch on Form2, I need to have the same ComboBox1 (without the need to build a new ComboBox and re-populate it with same values).
Is it possible?
This to avoid to do 2 time the same work, and to save precious memory of device.
Thanks
Ignazio
|
|
|
|
|
Hurricane3000 wrote: I need to have the same ComboBox1 (without the need to build a new ComboBox and re-populate it with same values)
Why?
How much work is involved?
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Hi,
I want avoid to have a duplicate of the same ComboBox in memory for 3 reasons:
1 - because application is for devices (Compact Framework)where memory must be used with parsimony. It can contain also 20,000 items
2 - To make more fast application avoiding to populate 2 times 2 different Combobox with the same data.
3 - Because to have 2 ComboBox with same items in the same program not sounds to be an "efficent" solution.
|
|
|
|
|
In that case you might have done better to post your question in the Mobile Development Forum, although it does not seem to be as active as this one.
I have zero exposure to the Compact Framework and therefore do not even know if this would work but you might have one list and use that as the DataSource for both ComboBoxes . Either by having the list in a library assembly, or by passing it as a parameter to the constructor of the Form (s).
Sorry not to be more help.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|