Click here to Skip to main content
15,918,333 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: Sharing data between Windows forms Pin
eagertolearn8-Sep-05 8:59
eagertolearn8-Sep-05 8:59 
AnswerRe: Sharing data between Windows forms Pin
roraima14-Sep-05 7:24
roraima14-Sep-05 7:24 
QuestionIntelligent Datagrid Pin
| Muhammad Waqas Butt |5-Sep-05 6:05
professional| Muhammad Waqas Butt |5-Sep-05 6:05 
AnswerRe: Intelligent Datagrid Pin
mikone5-Sep-05 10:16
mikone5-Sep-05 10:16 
QuestionOpen default mail client with attachments Pin
marowle5-Sep-05 4:19
marowle5-Sep-05 4:19 
QuestionListview selects? Pin
dave@ennead5-Sep-05 3:26
dave@ennead5-Sep-05 3:26 
AnswerRe: Listview selects? Pin
dave@ennead5-Sep-05 3:35
dave@ennead5-Sep-05 3:35 
QuestionSlow WMI-Query, what reason? Pin
mikone5-Sep-05 3:26
mikone5-Sep-05 3:26 
Hi Smile | :)

I tried to get some printer-informations by using a wmi-query. It works fine until a printer goes offline. It takes very long to get those informations then.

What do i want it to do?
- It should be much faster to get the printer-informations (about 3 secs, no matter whether a printer is offline or not)
OR
- It should run the application.doevents() command at least every second. (to provide a progressbar which is worth to be called a PROGRESSbar Wink | ;)


What did i already try to do?
- Optimize the WMI-Query (which was a bit successful at least)

- Set a seperate Timer which runs the application.doevents() command (for the possibility of a progressbar, which shows that the computer doesn't hang around)

The Query-optimization increased the speed by 1-2 seconds. but it still took too long to get the printer-informations.
The timer freezes if the specific line of code is executed (if all printers are online its about 3secs, if only one of the printers is offline, it takes up to 15 secs and more), so that's not the solution, too.

All together: very unsuccessful

I will show you some example code, so you may rebuild the problem, if you're interested in Wink | ;)

Declaration/Definition of variables:
<br />
        Private Printer As System.Management.ManagementObject<br />
        Private PrinterSelect As New Management.SelectQuery("SELECT Name, PrinterStatus, DriverName, PortName, Comment, Local, Network, Default FROM Win32_Printer")<br />
        Private PrinterSummary As New Management.ManagementObjectSearcher(PrinterSelect)<br />
        Private PrinterCollection As Management.ManagementObjectCollection<br />


executing code:
<br />
            PrinterCollection = PrinterSummary.Get()<br />
            'Application.DoEvents()<br />
            For Each Printer In PrinterCollection<br />
                   {...}<br />
            Next Printer<br />
            PrinterCollection = Nothing<br />



everytime the third line of executing code ("For Each Printer in PrinterCollection") being executed, the computer starts to hang.
please tell me, if you need more informations about the problem.

i would be thankful and pleased for every constructive response Smile | :)

so far,
mik
AnswerRe: Slow WMI-Query, what reason? Pin
progload6-Sep-05 9:41
progload6-Sep-05 9:41 
GeneralRe: Slow WMI-Query, what reason? Pin
mikone7-Sep-05 21:28
mikone7-Sep-05 21:28 
QuestionT-SQL Clause Pin
Greeky5-Sep-05 3:17
Greeky5-Sep-05 3:17 
AnswerRe: T-SQL Clause Pin
maximvs5-Sep-05 7:15
maximvs5-Sep-05 7:15 
QuestionBooks about .NET with examples for learning Pin
hcmuns5-Sep-05 0:59
susshcmuns5-Sep-05 0:59 
AnswerRe: Books about .NET with examples for learning Pin
Christian Graus5-Sep-05 11:29
protectorChristian Graus5-Sep-05 11:29 
QuestionRotation of Label control in vb.net Pin
premanand jha5-Sep-05 0:46
premanand jha5-Sep-05 0:46 
AnswerRe: Rotation of Label control in vb.net Pin
Briga5-Sep-05 2:51
Briga5-Sep-05 2:51 
QuestionSpecified argument was out of the range of valid values. Pin
Rabeek5-Sep-05 0:25
Rabeek5-Sep-05 0:25 
AnswerRe: Specified argument was out of the range of valid values. Pin
_mubashir5-Sep-05 3:23
_mubashir5-Sep-05 3:23 
Questionstucked newbie Pin
tatchung4-Sep-05 23:59
tatchung4-Sep-05 23:59 
AnswerRe: stucked newbie Pin
Christian Graus5-Sep-05 11:30
protectorChristian Graus5-Sep-05 11:30 
GeneralRe: stucked newbie Pin
tatchung5-Sep-05 14:59
tatchung5-Sep-05 14:59 
QuestionCrystal Report Pin
| Muhammad Waqas Butt |4-Sep-05 23:18
professional| Muhammad Waqas Butt |4-Sep-05 23:18 
QuestionMulti Line TextBox for Addresses Pin
Greeky4-Sep-05 22:17
Greeky4-Sep-05 22:17 
AnswerRe: Multi Line TextBox for Addresses Pin
Dave Kreskowiak5-Sep-05 3:10
mveDave Kreskowiak5-Sep-05 3:10 
AnswerRe: Multi Line TextBox for Addresses Pin
Greeky5-Sep-05 3:11
Greeky5-Sep-05 3:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.