|
What is the main use of LINQ(Language-integrated query) in visual basic?? I cant understand it properly when i read it from Msdn website.. Any other links??
|
|
|
|
|
|
|
Hi all,
I have a strange effect in a little test application which contains a ProgressBar control (set to 'continuous'), together with a list box and a label. All three of them are fed with values from a loop on a different thread (using a delegate) and updated within the same Sub (member of the main form). Just a very simple example from Micrsoft.
A funny effect now is that the progressbar seems to be updated with a delay: While the other controls show the value returned from the loop, the progressBar shows an approx. 10% lower value - i.e. when label and listbox show the 50% value, the progressbar stands at 40%, and when the loop is finished (label and listbox 100%) the progressbar still is at 90%. Just to mention it: The code updates the progressbar FIRST with the percentage (with Statusbar.Refresh), and after that updates the other controls.
In the application that I plan I didn't want to show the values in labels etc, so the progressbar should show progress more accurate. Compared with the other controls, it also seems to start a little bit delayed...
Are there any known issues with the accuracy of progress bar? Or am I dealing with something like 'race conditions'?
Thank you,
Mick
|
|
|
|
|
Without seeing your code, it's impossible to tell you what you did wrong.
|
|
|
|
|
Hi Dave,
it's basically the code from the Microsoft sample which I had linked to ('Control.Invoke Method'), just with an additional progressbar. But your answer sounds like it's not normal that the control lacks accuracy... The minor changes I made are in the following method:
Public Sub AddListItemMethod()
Dim myItem As String
Dim max As Integer = 50
Dim i As Integer
Dim percent As Integer
For i = 1 To max
myItem = "MyListItem" + i.ToString()
percent = CInt(i / max * 100)
ProgressBar1.Value = percent
StatusStrip1.Refresh()
myListBox.Items.Add(myItem)
myListBox.Update()
myLabel.Text = String.Format("{0} entries ({1}%) added.", CStr(i), percent)
myLabel.Update()
Thread.Sleep(30)
Next i
End Sub
I also reduced the Sleep time of the thread - that's why I asked if 'race conditions' might be involved. It seems as if the delay between label/listbox and progressBar is getting bigger with a lower value for 'Thread.Sleep' - very little delay with 800, much bigger delay with 20 or 30.
|
|
|
|
|
It doesn't work because you're hogging the UI thread with this code. The Thread.Sleep doesn't help.
What I mean by "hogging" is that you're not letting the UI thread process any messages from Windows, like WM_PAINT, that tells individual controls to update themselves. For a "quick fix" you can replace the line that says myLabel.Update() with Application.DoEvents() . This will process all pending messages in the application message pump, including drawing messages.
This is NOT the correct way to do this! This is a hack to get your example code working! The correct way to do this would be to move the long running code (you simulated this with the Thread.Sleep call) to a background thread and Invoke calls to update the UI controls on the UI thread.
|
|
|
|
|
ive seen all the post related to my problem.. but i have different code .. i've searching for the answer for almost 2weeks now .. but no luck .. this is my code i dont know what's happening .. it keeps prompting Verification Failure .. i dont know whats the problem in my code .. the bolded line's where i guess the problem occurs .. can someone kindly help me to fix this im using vb.net 2010 as my front and MySql as my back-end.. im using DigitalPersona 4000B
Sub OnComplete(ByVal Control As Object, ByVal FeatureSet As DPFP.FeatureSet, ByRef EventHandlerStatus As DPFP.Gui.EventHandlerStatus) Handles VerificationControl.OnComplete
Dim con As New MySqlConnection("Server = localhost; Username= root; Password =; Database = fesdata")
Dim cmd As New MySqlCommand("SELECT * FROM empdata", con)
con.Open()
Dim fpreader As MySqlDataReader = cmd.ExecuteReader
Dim byteTemplate As Byte()
Dim memStreamTemplate As MemoryStream
Dim ver As New DPFP.Verification.Verification()
Dim res As New DPFP.Verification.Verification.Result()
If fpreader.HasRows Then
While fpreader.Read
byteTemplate = fpreader.Item("Fingerprint")
memStreamTemplate = New MemoryStream(byteTemplate)
Dim templa8 As DPFP.Template = New DPFP.Template()
templa8.DeSerialize(memStreamTemplate)
If Not FeatureSet Is Nothing Then
ver.Verify(FeatureSet, templa8, res)
If res.Verified Then
Call SEARCH_EMPLOYEE()
End If
End If
End While
Else
MsgBox("Unknown Employee!")
End If
fpreader.Close()
End Sub
|
|
|
|
|
You're better off asking this question in a forum dedicated to the library you're using, usually the manufacturers own site.
You also don't describe what the problem is. "It doesn't work" does not suffice for a problem description. If you've taken 2 weeks to get nowhere, you're severely lacking in debugging skills. Stepping through the code in the debugger and looking at the values of variables should tell you a lot of about what you're code is actually doing compared to what you think it's doing.
|
|
|
|
|
What does exception.message , exception.stacktrace means? what details it gives??
|
|
|
|
|
|
For the past year, we have been running our VB 2010 data entry application for our 2 joint organizations. The main member form took about 5 seconds to display because there are 3 tabs to display (General, Organization 1, Organization 2) and the 2 Organization tabs have 4 tabs to them. Lots of data to display with lots of controls.
Starting around Thanksgiving, this form suddenly started taking up to 4 minutes to initially load; after the first load, any other member data displays (different members) were back to the 5 seconds. No changes to the program, so it has to be something else. Watching task manager in Windows 7 Pro, memory usage climbs slowly to 931 MB, then drops back to 19 MB and the form displays. Getting the memory is what takes so long. Running in the IDE, there is no memory problem - just when employees run the published program.
I put MSGBOX commands in the program to confirm where the slowdown was since debugging in the IDE wasn't an option:
msgbox("Starting New Form",MsgBoxStyle.Information)
dim frm as new frmCustomer"
msgbox("New Form Done",MsgBoxStyle.Information)
It is definitely the command creating the new form. 4 minutes and 931 MB of memory.
Anyone else experiencing something similar? Any ideas on how to fix this?
|
|
|
|
|
Not enough information. It's not that command slowing this down. There's a constructor in that frmCustomer class that is running code. What is so slow in that code?
|
|
|
|
|
I don't think this has anything to do with VB it self.
do you load data when you create this form? if so test to see how long that takes.
Every day, thousands of innocent plants are killed by vegetarians.
Help end the violence EAT BACON
|
|
|
|
|
What is the exact use of delegate?? Someone Tell me in simple way.
|
|
|
|
|
|
Hi to all. I want some basic VB tutorials for start.Thanks.
|
|
|
|
|
Try this link[^]
=========================================================
I'm an optoholic - my glass is always half full of vodka.
=========================================================
|
|
|
|
|
|
You mean VB6?
If yes,
why? VB6 is dead(still few zombies alive). Go with VB.NET. Download Visual studio express edition[^] & start learning.
But still you want VB6 things? Then go here. http://www.thevbzone.com/[^]
-------------------------------------------
If No,
Use Google search for tutorials. Codeproject has a section for VB.NET[^]
-------------------------------------------
And Education Needed[^]
thatrajaCode converters | Education Needed
No thanks, I am all stocked up. - Luc Pattyn
When you're wrestling a gorilla, you don't stop when you're tired, you stop when the gorilla is - Henry Minute
|
|
|
|
|
hi there,
how to develop a barcode generator in vb.net 2008 in windows forms
please help me out am really in need for this
|
|
|
|
|
|
Hi I am working with Visual Basic application on one of my data logging unit in which data speed is 1000 sample per second the data logging unit will run for one or two complete day. Which means for one day data amount will be 86400000 samples can easily be stored in below buffer. Or partially after 2-3 hr data can automatically save to selected drive.
How I can save data above data in excel format. Or which is the best way to store data. Below is my buffer in which data get store:
Dim DataSet(0 To 1000000000) As String
Public Sub OnRead(ByVal pHandle As Integer)
If StartLogging = 1 Then
Time(SamplePerSecond) = TimeValue / 1000
DataNo = DataNo + 1
DataSet(DataNo) &= TimeValue / 1000 & vbTab & (Int((CH1_RawADC - CH1_Tare) * CH1_CalibrationFactor) / CH1_DP)
End If
End Sub
Himanshu
|
|
|
|
|
If you need to save it so it can be read by Excel, I'd say at the end of the sampling period, write the dataset to a CSV (comma separated value) file.
A quick check of my Excel (Office 2010) shows a maximum row count of a little over 1,000,000.
Since you expect 86,000,000 samples, you will have to have 86 or more samples per row.
Hope that helps.
Tim
|
|
|
|
|
Hi Thanks for your replay. It is quick way to store data in this CSV format but main disadvantage is "lot of file is created". Excel got one advantage that new sheets can be open with in one file.
Yet now I am able to open excel file and export data to different sheet but because of big no of sample Excel keep on working for about some minutes. So I am looking to do it in fast way.
If this can done it will be great. Using CSV with 1,000,000 row limit and than work with 2sheet of same CSV file?
|
|
|
|