VS 2010 - Advanced Code Which Uses Threading, Pointers

Mar 30, 2011

I had recently(2 months before ) found some code for locking the screen. Here's the link to that code submission in our CodeBank : [URL]

I wish to get a clear idea of what it actually does. As it is a bit advanced code for me.

Here's the main part of the

CODE:

View 6 Replies


ADVERTISEMENT

VS 2010 - Threading - Button To Stop Execution Of Code

Apr 22, 2011

I am working on an app and I am a bit confused w/ threading. I understand the point of threading but I am not getting when to use a background worker thread vs. a standard thread vs. a thread pool. Can someone shed some light on when to use which? Right now, I am trying code an app that does stuff initially in a sequential order and then eventually must thread (otherwise it takes forever). The problem I am having w/ the sequential stuff (and threading later) is that I need a button to be able to stop execution of code. [Code]

I did the background worker on this first sequential operation because when I tried w/ out it, the text box didn't update at all until the web page contents were retrieved. Basically, the text box change of "Starting." doesn't show up until the web page is finished processing even though the assignment to the text box happens before that code.

View 11 Replies

Code To Change Advanced Power Settings?

May 17, 2012

I am currently working on a project in VB.net that requires the advanced power settings of the client's system to be set to allow wake up timers for when the system sleeps. Please I have been looking around for the solution. I desperately need it.

View 1 Replies

Why Is Control.CheckForIllegalCrossThreadCalls = False Bad - .NET Advanced Discussion | Dream.In.Code

Apr 26, 2012

Control.CheckForIllegalCrossThreadCalls = False

View 6 Replies

VS 2010 Advanced String Parser?

Nov 1, 2011

I have textbox1.text ( multiline) that is filled with data from a external .txt file. On each line of textbox1.text i have the folowing data:50ABCDEFGHIhsfgsdf60JKLMNOJ55JK4

I need a way to display in my second textbox ( textbox2.text - multiline also) on each line the fallowing data: "NUMBER1" & ABCDEFGHI & "NUMBER2" & JKLMNO So basically i need to find the "50" string,remove it, read "9" characters after it, same goes with 60 and JKLMNO I have a undefined non-fix numbers of lines in textbox.text1

View 3 Replies

VS 2010 Advanced Folder Browser Dialog?

Aug 4, 2011

i am using FolderBrowserDialog to open a folder in my project.Every time user has to traverse through many subfolders, so is there any advanced folderbrowserdialog control to paste the folder path directly?

i have seen this API,but its not much good look in vs 2010 project.

View 3 Replies

Make An Advanced Taskbar In Virtual Os In Visual Basic 2010?

Aug 8, 2011

Ik how to make a taskbar but how can i make it minimized and go to the taskbar as a icon and be able to open it up again the way it was?

Bonus Question: How can i make it savable so when you leave the os the settings will be the same as you left?

Bonus Question 2: How can i make a save document button?

View 7 Replies

Make A Very Advanced Picture Viewer (Editor - Zoom - Slide Show) In VB 2010 Express?

Aug 29, 2010

I Want A Picture Viewer With this Features : Editor, Zoom, Slide Show

View 12 Replies

Asp.net - Threading Settings After Converting Vb6 Code To .net?

May 25, 2012

We use a number of VB6 DLLs in classic ASP, using Server.CreateObject in the ASP page. The DLL code has recently (as a test) been converted to VB.Net 2008, and all the obvious issues that usually arise have been dealt with, meaning we are now able to use a .Net version of the DLL in classic ASP using interop (by using regasm to register the assembly for use in COM). The code that the converter added to the objects to make them usable in COM was <System.Runtime.InteropServices.ProgId("My.ObjectName")>, just before each class definition.

We have started noticing an inconsistent performance issue when using this new version of the DLL vs. the VB6 version in that it can sometimes take much longer to perform some tasks (even the task of constructing the objects from the DLL). In fact the same unit of work, including some DB work - now through interop ADO - can vary wildly (This is not limited to ADO work though!). We have started looking into this to try to figure out if it's some constant source of inefficiency, or if it's a load issue (threading related maybe).

I cannot seem to find a straight answer to the issue of threading when converting the code base. The DLL in VB6 is configured to use "Apartment Threading", the only other option being "Single Threading". Is this something that requires attention and is relevant when converting to .Net given we are still using the DLL through COM, and does anyone know what needs changing/configuring/checking?

View 1 Replies

Use Threading, QueueUserWorkItem To Execute A Line Of Code?

Feb 8, 2010

I am trying to execute a line of code that i'll call f(x) and include a timeout. f(x) is an function in excel that can fail catastrophically. I did not code f(x) and the failure generates a dialog box. When 'ok' is clicked, Excel immediately closes. BTW: error trapping (On Error Resume Next) does not trap this error.

[Code]...

View 5 Replies

VS 2008 - Multi Threading - Error Code

Oct 11, 2011

Wheres my error on this code...

Imports System.Net
Imports System.Threading
Public Class Form1

[CODE]...........

Basically what I want to do is that User will select how many thread w/c is the PickThread.value, then it will do the stuff.

View 11 Replies

VS 2008 [Multi-threading] How To Run This Code In A Separate Thread

Apr 21, 2009

I am creating an IDE for a game script with similar functionality as the Visual Studio IDE (at least, some of it). The game script consist of code that looks visually a bit like C code. It uses braces to define the start and end of a 'class' and uses nested braces to define the start and end of an 'event' in a class.

What I want finally is to have two Comboboxes above the text editor, one that lists each Class and the other listing each Event. The comboboxes should also show the Class and Event that the caret is currently in, just like in Visual Studio.I have attached an example of such a script (you can open it with Notepad).However, here is a short example where you can also see how I "defined" classes and events:

class1
{
event1
{

[code]....

As you can see, the classes are the 'names' of each block of code, defined by matching braces { }. The events are the names of each nested block of code, also defined by matching braces { } but inside a class. There is only one level of nesting.As you can also see, the layout can follow the standard C-style layout, or a slightly different layout (using the opening brace on the same line as the class/event name), or even a completely chaotic mess. As long as the braces match correctly, the code is valid.So in short, the large blocks are classes, while the nested blocks are events.

What I want to do, is parse an entire script, and store all the Classes (and eventually, also all the Events, but let's forget about them for now). I want to store the Class name, start position (defined as the start index of the name), end position (defined as the index of the closing brace) and the full text (defined as the text between start and end position, so including the name).

vb.net
Public Class clsClass
Private _Name As String

[code]....

The code works basically by finding every first opening brace (the opening brace of each CLASS, not event), and then loops through the class (using a brace counter to keep track of the nested braces) until it found the last closing brace. It then stores the name, start, end and fulltext in a new clsClass and adds it to the list to return.

View 3 Replies

VS 2008 - Multi-Threading - Code That Will Need To Be Repeated But With A Chance Of It Overlapping

Jul 29, 2009

Multi-Threading. I have got a simple bit of code that will need to be repeated but with a chance of it overlapping the only complex bit is there will be a varible that will be different each time. so I was wondering if I put it in another Thread and store the varible within the thread code would that achieve what I am looking for? To make it slightly easyier once the thread is started and pulled the Varible in there will be no cross talking between the thread and main app thread (ie no progress reports, no aborts/suspends etc) Nothing will be feeding back on thread completion either, when it ends it ends.

This is what I have so far:

Imports System.IO
Imports System.Threading

[CODE]...........................

View 5 Replies

Multi-threading Mechanisms To Run Some Lengthy Operations From Winforms Code And Communication With GUI

Mar 16, 2010

What do I want to achieve: I want to perform some time consuming operations from my MDI winforms application (C# - .NET). An MDI child form may create the thread with the operation, which may take long time (from 0.1 seconds, to even half hour) to complete. In the meantime I want the UI to respond to user actions, including manipulation of data in some other MDI child form. When the operation completes, the thread should notify the MDI child that the calculations are done,so that the MDI child can perform the post-processing.Should I use explicit threading (i.e., create explicit threads), thread pools? Or simply just propose your solution. Should I create foreground or background threads?And how does the thread communicates with the GUI, according the solution you propose?

View 7 Replies

VS 2008 - Use The Threading.Thread.Sleep(2000) Code The Form Becomes Unresponsive

Jul 20, 2010

The coding that I have a problem with might make people think that I am creating some malware. So the project I am doing is associated with iTunes. iTunes allows people to have one library. There is another way, but it is very confusing to some people, and very unreliable. So my project is that I will allow people to have multiple iTunes libraries on one computer. So the problem is this. In order to have an option to choose your library, I gotta make sure that iTunes is not running.

So this is the script:

Private Sub CheckAndCloseiTunes()
retry:
'Custom class that includes the function to safely close iTunes
Dim Processes As Process() = Process.GetProcessesByName("iTunes")

[CODE]...

So when I use the Threading.Thread.Sleep(2000) code, the form becomes unresponsive.

View 4 Replies

VS 2010 Can't Do Threading?

Apr 25, 2012

I have a problem. I'm creating a new thread, which should do some stuff and update a text box. But, when I test my program, the main (UI) thread is doing all the job, even though I declared and started a new thread.

[Code]...

I even made another thread for testing purposes, but it was the same.

View 2 Replies

VS 2010 Having The Multi-Threading IP's?

Dec 11, 2010

I've been raking my brain for quite some time on this. Is there any way with VB.NET that I can use multiple IP's in one instance of a program? For example, I want to be able to navigate to a web page 10 times at once, with each one using a different IP. I want them to be parallel (multi-threaded) rather than going sequentially. Going sequentially, I could just do the action, change the IP, do the action, change the IP.

View 5 Replies

VS 2010 Multi Threading The Right Way?

Jan 10, 2012

I have a button and when it's clicked a HTTP request is sent out to a website to do a few things, but because its got to load the external resources it makes the interface frozen. I've moved the HTTP onto another thread using the follow

VB.NET Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim Thread1 As New System.Threading.Thread(AddressOf check_accounts)

[Code]...

When i want to update a label that is on my main form (from the check_accounts sub). I know that isn't the right way, but i have no idea what the right way is. All the documentation i can find is very (excuse me for this) nerdy and really doesn't offer much insight on how to incorporate it into a project.

I want to be able to have a numericupdown box that can let the user change the amount of threads they want to use. I assume more threads allow the http requests to be done faster and at the same time?Also if i wanted to pause the HTTP requests, would the best method to use be pausing the thread?

View 12 Replies

VS 2010 Threading WithEvents?

Sep 7, 2011

I have an application that performs a lot of busy work. All of the work is performed using a BackgroundWorker and the point of execution is the DoWork Event of the BackgroundWorker.On the UI thread, before the workload begins, I display a PictureBox that contains an animated GIF that illustrates progress; for the most part this works fine and the UI thread is not paused or slowed while the BackgroundWorker does its job. There is however, one instance where the UI thread is impacted by the work being done and it defeats the whole purpose of putting this work in a separate thread. In this application, the user must wait until the work completes before they can move to the next step, so my sole reason for moving this all to a BackgroundWorker was so that I could display a smooth, uninterrupted progress indicator on the UI thread while this work was being done, so that the user could see that something was happening.

The case where the work being done is impacting the UI thread (pausing/delaying the PictureBox animation) deals with a referenced COM object.

[Code]...

All of the COM object event handlers and subsequent functions are appropriately using Delegates, but I am not sure why the ProcessFiles method would cause the UI thread to hang while the work completes; I thought that was the whole purpose of the BackgroundWorker.

View 6 Replies

VS 2010 Multi-Threading Application?

Apr 5, 2011

I am working on an application that is taking pretty long to execute. I started playing with mutli-threading and it seems to have greatly sped up my app. Problem is that threads are still executing and the rest of the code executes before the threads finish. Here is my

[Code]...

View 4 Replies

VS 2010 Shared Variables And Threading Pin?

Mar 12, 2012

So I am currently attempting to wrap my head around create multi-threaded programs and I am currently running into an issue when using a Shared variable across multiple threads.The program is structured as follows: Public Shared IsActive as Boolean

Main Thread = GUISets the Value of IsActive through a Button ControlTwo Worker ThreadsBoth threads are while loops that read the IsActive Boolean Ex:While IsActive = True Do Work End WhileHowever when I change the value of IsActive from the Main Thread it causes the worker threads to stop (ThreadState = 16).

I have been reading that I have to synchronize/lock shared resources and have tried SyncLock and Monitor methods without success (it is entirely possible I am not using the above correctly, so If someone could provide proper examples for the above situation using the mentioned methods please share them).

View 4 Replies

VS 2010 Threading - Add A 1 Second Delay Between Calls?

Jul 31, 2011

to some server via an UdpClient. However, I need to make sure that all commands send are separated by a 1 second delay. If there is no delay, two commands send within this 1 second timespan will not be received both; only the first or the second command will get through.he commands are sent in a background thread at the moment, because it might take some time before the command is sent. I keep looping until the command has been sent, like this:

vb.net
Public Sub Send(command As String)
Dim bytes = Me.GetCommandBytes(command)

[code].....

View 4 Replies

VS 2010 Threading And Sending Mail

Nov 24, 2010

I am getting error when I am putting my sendmail function into other thread. But without threading the message was sent successfully. I am getting error in this part when sending using thread. mail.Body = EmailBody.DocumentText It say: Specified cast is not valid. Here is my code for sending email EmailBody is a webbrowser in Desing MOde ON

[Code]....

View 7 Replies

VS 2010 True Multi-threading?

Dec 20, 2010

I'm having some issues with parsing a lot of information into controls using winforms. I've tried adding threads/backgroundworkers, but they don't seem to work properly. To avoid the cross-thread exception, I had to add an invocation checker:If Me.InvokeRequired Then Me.Invoke(New MethodInvoker(AddressOf ParseSub()))This just freezes the form as it would without threading, but without the invoke checker I get cross thread exceptions because information from one thread is trying to be sent to another.

View 6 Replies

Manage Pointers In .Net?

Dec 15, 2010

Id'like to pass some variables (string and integers) to a class, and when I call a method of that class, it has to change the original variable.I know it was not impossible in C#, but I'm using VB2010, I made a C# project into my solution, but methods using pointers are hidden into VB. How can I make that kind of change?

An example:

Sub ChangeValues()
Dim A As Integer = 1, Str As String = "Start String"
Dim X As MyClass(A, Str)
X.ChangeInt(2)

[code]....

View 11 Replies

Simulating Pointers In .Net?

Jun 9, 2010

have a 2d array of structures that holds about 5 or 6 details on each cell. The array size will not be known at compile time so I am using ReDim to resize it. I also have a list (think I have it as an arraylist actually but shouldn't matter really) that I would like to hold a pointer to one of the 2d array elements (as well as some other info). The list is a much smaller subset of the 2d array. The reason I am doing this is that the list needs to be sorted based on some data in the 2d array that will be changing. I don't want to have to search through the list each time to update the values as these lists and arrays can potentially be very large.

Maybe there is a better way to handle this but even if there is I would like to know how to simulate pointers in VB.Net. I know there are IntPtr's and references that I could probably use but I have no idea how to do it with dynamic arrays of structures. I'm familair with pointers from C++ but this is the first time I have tried to use (or simulate since there seems to be no real support for them) in VB.Net.

Not sure how clear that was so here are some snippets of the data types involved and some initialization.

Code:
'structures that are in the 2d array
Structure SearchNode

[code]....

View 6 Replies

VS 2010 - Multi-Threading Managing Threads

Aug 31, 2011

I started a threading project and want to manage my code so that it waits for all the threads to be finished before displaying to the user on the main UI thread that it has completed the task and waiting for the user... I've created a List to manage the threads and a global Boolean, "blnStop"...

[Code]...

View 9 Replies

VS 2010 Loading Combobox (remote) Database (threading)?

Oct 7, 2011

I'm loading 3 comboboxes and a treeview with values, from a remote database when the app starts. As we all know the app freezes until it's done loading. I want to speed things up.

Dim _thread As Thread
_thread = New Thread(AddressOf test_loading)
_thread.Start()

[code]....

When I execute this code I get the following error:

mycomboboc.Items.Add(reader.Item("columnname").ToString)Cross-thread operation not valid: Control '' accessed from a thread other than the thread it was created on.

View 14 Replies

Multidimensional Arrays / Vectors And Pointers?

Oct 15, 2011

I'm looking for something similar to using vectors and pointers that I've used before in C++; unfortunately, it doesn't seem like there's an equivalent function in VB.net.What I have is a copy of the array behind a multi-line Rich Text Box, and I need to separate the words from each line (or element of the array) so I can analyze each one separately.In C++ I would do something like this, so I could continuously expand as needed:

[Code]...

View 6 Replies

Pasing GridView Pointers To Other Forms

Feb 3, 2012

i am new to commercial programing (and this site) I am currently studding Computer science at a university and i have hit my First roadblock.I am currently developing an application that displays a Table on one Form1 in a Read-Only format and a second Form2 which will only be displayed if after selecting a row on the Grid-View of Form1 you press an Edit button.We are doing that to avoid the User editing the DB in large. The Form2 is populated by a details view of the Table with no controls to change row on the table.What i am trying to accomplish is passing the information of which row was selected in Form1 to Form2 thus making it the current row and subsequently the only one been edited. Currently most things work but as soon as Form2 shows (Form2.show()) it will only display the first row of the database.I want to know if there is a way to "sync" the two indexes.

View 3 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved