|
I've never seen any kind of method in any library that changes the refresh reate of a web cam. But, that doesn't mean there isn't one in the SDK that should be provided by the manufacturer of the webcam that you're using.
|
|
|
|
|
Hey everybody,
in a MDI window I have a status bar with a ToolStripStatusLabel and a ToolStripProgressbar which I want to use from different forms. For that I use a delegate which calls the ShowProgress function (located in a module).
Public Sub ShowProgress(ByVal Total As Long, ByVal SoFar As Long, ByVal file As String, ByVal Message As String, ByVal Timespan As Integer)
Dim percent As Long = ((SoFar / Total) * 100)
'MsgBox(MDIMain.ToolStripStatusLabel.Text)
MDIMain.ToolStripProgressBar.Value = percent
MDIMain.ToolStripStatusLabel.Text = percent.ToString & "%"
MDIMain.ToolStripProgressBar.ProgressBar.Refresh()
End Sub
When I uncomment the MsgBox line I can see that the function is actually called and that the values are assigned. But neither the StatusLabel nor the ProgressBar show anything else than their initial status...
Can someone please tell me what I don't consider here?
Thank you
Mick
|
|
|
|
|
as long as SoFar is in the range [0, Total) the value SoFar/Total will be zero (and your MessageBox has told you so). It is only when SoFar reaches the value of Total that all of a sudden your app will reach 100%.
You'll have to rework your formula.
|
|
|
|
|
Unfortunately it's not so simple... my MessageBox tells me exactly the initial text of the StatusLabel and the increasing percentage every time the function is called (= Total times).
|
|
|
|
|
Ha, VB.NET is fooling me and probably you too.
Me in think long/long results in an integer, which is true in normal languages, not in VB.
You in thinking you can have a huge long value and assign it to ProgressBar.Maximum (or Minimum or Value) which actually expects a 32-bit integer, however accepts all values that are larger than the Minimum (default 0) and will happily ignore the top 32-bits.
|
|
|
|
|
Ok, I really tried and changed the referring line to Dim percent As Integer = CInt((SoFar / Total) * 100) . The result is still the same - nothing visible happening... except when I activate the MsgBox which bravely keeps telling me the correct percentage.
Btw: Not only the ProgressBar refuses reaction, also the StatusLabel does!
In order to check if I'm addressing the right form I also changed the initial text of the StatusLabel in the disigner. But I get it reported correctly (i.e. with the change) from my MsgBox as the first value.
It must be something else
|
|
|
|
|
IS the task you're trying to show progress on, running on a different thread ? If not, then it's taking over the processor and so no updates occur
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
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
|
|
|
|