Access Progress Bar On Main Form From Thread On User Control?

Aug 18, 2009

I have a windows application with a main form, on which a user control is added dynamically when a device connects trough USB.

On a user control, there is a thread wich is getting data from the device trough USB and when it is finished, I want to change a progressbar that is located on the main windows form where user control reside.

This is the code that is I call on the user control thread to change the progress bar value:

Frm_Main.UpdateProgressBar(CInt((AllBytesReceived / MaxBytesInFlash) * 100))
and this is a code that is called on the main form:
Private Delegate Sub UpdateProgressBarDelegate(ByVal value As Integer)

[Code]....

View 8 Replies


ADVERTISEMENT

Creating A Progress Bar That Runs On Another Thread While Keeping Calculation In Main Thread

Nov 12, 2009

Preface: I know this is an unusual/improper way to do this. I can do this with a "real" ShowDialog(), background worker/thread, and so on. I am trying to do specifically what I describe here, even if it is ugly. If this is impossible for X reason, I have created a fancy progress dialog for some of our long running operations. I need to have this dialog shown on a new thread while having processing continue on the calling (UI in most cases) thread.

[Code]...

View 3 Replies

Threading Progress Bar In .net - Thread Operation Not Valid Control 'ProgressBar1' Accessed From A Thread Other Than The Thread It Was Created On

Feb 17, 2012

Would anyone be able to help me here please. I'm fairly new to VB.net and threading so im just trying to figure out what is happening.When I debug this I am getting the error thread operation not valid: Control 'ProgressBar1' accessed from a thread other than the thread it was created on.

I'm a little lost as to why the error is occuring or how to fix it. I've had to put the progress bar in a separate thread otherwise the GUI crashes

[Code]...

View 2 Replies

Forms :: Access Main Form From Second Thread Running In A Module?

Jun 22, 2010

I was a vb6 user, done a few projects only with forums Now i am moving to vb.net(vb2010) and i have some trouble.Lets say we have a form(form1), a module(mod1) and a textbox on the form1.

i want to start a Sub (DoWork) in the module but in a new thread.

Dim Thread1 As System.Threading.Thread
Thread1 = New Threading.Thread(AddressOf mod1.DoWork)
Thread1.Start()

The DoWork sub does some stuff and when it's finished i want to change the text of a textbox1 in the main form and start another sub (DoWork2) on the main form under the main thread not the one DoWork is running under.

Plese do not refer me to another post that mighe give me a part answer, try to explain to me what i have to do and why.

View 3 Replies

One Trigger A Click Event In A UserControl From The Main Form's Tab Index Control That Contains An Instance Of The User Control?

Jan 5, 2011

The code is listed below which hopefully illustrates what I'm trying to do:[code]....

View 12 Replies

Access Objects Of Main Thread From BackgroundWorker's Thread?

Aug 4, 2011

I'm working with BackgroundWorker, I want the BackgroundWorker do the retrieval process of data from database while the user can still do another task on the form. The problem is, after retrieving the data, I can't seem to access the ListView in my Form from the DoWork event of BackgroundWorker, I will populate that ListView using the data I've retrieved.

Consider this example, this is how I'm doing it:

Public Class Test
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

[Code].....

View 1 Replies

Send Data From User Control To Main Form?

Nov 25, 2010

I have a main form and a user control form. The user control form is on the main form. How can I send data from user control label1 to main form label 1?

View 3 Replies

Databound User Control Doesn't Display Data In Main Form?

Apr 23, 2009

I need to quickly demonstrate a project and decided to create a user control that is connected to an Access database through pure simple data connections (create the dataset and drag it on the control.)When I build the project and add the usercontrol to panel control on the main form, no data is shown in the datagrid.When I add the data components directly on the main form, the data is displayed properly. why I can't get my databound user control to display the data on my main form?

View 2 Replies

Forms - RichTextBox User Control On Main Form - Error: StackOverflowExecption Was Unhandled

Apr 7, 2011

What I have is a user control that has two RichTextBoxes. In the user control, there is RichTextBox1's TextChanged event, I want it to set RichTextBox2's Text to the same as RichTextBox1's Text, I'm currently using: RichTextBox2.Text = RichTextBox1.Text. The user control is on the main form, when I run the application and type I get this error: StackOverflowExecption was unhandled. [Code]

View 4 Replies

Load The Main Form Of A WPF So That A Separate Thread Goes And Gets Data From The Database While The Form Is In An Apartmentstate?

May 15, 2012

How do i load the Main form of a WPF so that a seperate thread goes and gets data from the database while the form is in an apartmentstate? (drag-able / movable) I Know this is possible with opening a new window from your main form like this :

Private Sub openOrderWindow()
Dim OrderWindow As Orders = New Orders
OrderWindow.ShowDialog()
End Sub

[code]....

I've tried putting MyBase.ShowDialog() and .Show() and .9000+ other things The only benefit I've got out of using a seperate thread to load from the databse is i can see the screen right away (as oppose to it being a transparent box until it loads) but i cannot move it around or minimize it?is there any way to make it Movable while it loads?

View 1 Replies

Forms :: Main Form Minimized After Opening Form In A Different Thread?

Jun 7, 2009

In the main form the user can choose to download information from a device.Since this request takes time, when "download information" is pressed I open new form in a separate thread: Private Sub RunDownload()

[Code]...

View 3 Replies

Background Worker / Progress (Report To Default Instance Of Main Form)

May 23, 2012

I am using background worker to report progress on the screen. In the Main.vb I have the following

Public Sub report(ByVal sender As System.Object, ByVal e As System.ComponentModel.ProgressChangedEventArgs) Handles bwlistener.ProgressChanged
Dim message As String = e.UserState
logRTB.AppendText(message & vbCrLf)
End Sub

When I call this from Main.vb I use:
bwlistener.ReportProgress(0, "Some status text goes here")
It works great. The problem is when I try to call it from any other module in my project.

When I call it OtherFile.vb:
Main.bwlistener.ReportProgress(0, "Some status text goes here")
It doesn't work... The program doesn't crash. Debug goes through everything but no output is actually shown to the end user.

View 16 Replies

VS 2005 Class Api Needs To Get A Handle On Form Elements In The Main Worker Thread

Sep 4, 2009

I have a standard windows application called winap. I have a com component which acts as an api to the winap. I have a class in winap call classapi which has all the methods that the api calls and all works well. The problem is that one of the methods in my class api needs to get a handle on form elements in the main worker thread. Whenever I try to access an existing form I keep getting null because the for exists in the main worker thread and my api call is in a seperate thread.

[Code]...

View 5 Replies

VS 2008 - Ftp Download - Thread Reports It's Progressto Another Form (to Progress Bar)

Jul 12, 2010

I hve threaded ftp download, and that thread reports it's progressto another form (to progress bar). Now, when thread downloads, progress of thread is much slower than actual download is, so for instance: all files get downloaded, but the progressbar is at 50% or even less. Is there a way to track the progress of actual FTP download.

View 7 Replies

Write In Worker Thread In A Data Table And Rich Text Box in Main Thread

Mar 4, 2009

I'm creating a Client Server application which involves theServer running some scripts in clients and getting back results in an automated way. In Server, other than Main thread, i have 2 worker threads, a) one monitoring response from clients and b) the other scheduling next available job to respective client which executes that job. The issue here is ,I want these worker threads to write the status of their work in the UI(which comes under Main Thread). Also i need to write things in worker thread in a Data table and Rich Text Box in Main thread. But, I can't do so, since it has been blocked to access one thread's function or property directly from others. Is there any work around to do this?

View 8 Replies

Thread State - Thread In An Application Which Calls A Sub Routine Main()

Jul 26, 2010

I have a thread in an application which calls a sub routine Main(). The Main sub routine in turn call several sub routines/functions from with the same module,several different classes in the same application. Also some sub routines/functions call routines from a class library. Now say the routine/function in class library goes into a infinite loop and never returns. I would like my thread in the application to raise a event and display message to the users about the infinite loop. I am giving some sample code for the application.

Imports System.Threading

Module VMain
Public gbSuspend As Boolean

[CODE]...

View 7 Replies

Panel On A Main Form Containing A PictureBox Control On Top Of A TableLayout Control

Mar 15, 2010

I've got a Panel on a main Form containing a PictureBox control on Top of a TableLayout control. Both the child controls have their docking properties set to Top. The Picture control has sizemode set to Zoom.

What I'm finding is that the picture doesn't size properly when I start the app. There is a border at the top and bottom in the PictureBox control. It's only when I resize the overall form that it's correct.

So at the moment I've got this ugly bit of startup code, just to fix the problem Me.WindowState = FormWindowState.Normal Me.WindowState = FormWindowState.Maximized

What am I missing?

View 2 Replies

IDE :: Main Form Is A Login Form If The USer And Password Matches

Mar 25, 2010

im trying to do where the main form is a login form if the USer and password matches that in the code it goes to the main screen if it doesent it launches a form saying this user and or password is incorrect and when you click ok it closes that message window as well as the login form stop the program from launching is has to match the user and password from the text on text box one and masked textbox 1.

View 3 Replies

VLC Media Player With Progress Bar - Refreshing User Control

Jan 17, 2010

I'm writing a program that relies on an underlying VLC media player. I want to run a progress bar to show how much of the track has been played. How should I update the control? Should I use a timer firing at 1ms and update values when it ticks, or is there a better way?

Intel Quad Q9450
4Gb Ram
3x500GB Hard Drives
NVidia 8800GT
Marian Marc 8
VB Express 2008

View 5 Replies

Fire An Event In Main Thread From Another Thread?

Sep 24, 2009

could someone tell me how to fire an event in main thread from another thread as well as fire and forget without use a new thread?

View 9 Replies

Run A Method On The Main Thread From A Separate Thread?

Dec 31, 2010

I'm reading data from a serial port, but the DataReceived event of SerialPort is handled on it's own thread. I want to handle this on the main thread, but simply declaring an event and raising it still results in it being processed on the SerialPort thread. I'm assuming I need to declare a delegate I can call, but I don't see how that would work.

For example, I want to call Sub HandleDataReceived() on the main thread from the DataReceived thread, having HandleDataReceived() run on the main thread. How would I do this?

View 1 Replies

User Controls Hide And Show In Main Form

Feb 8, 2012

I have a couple of user controls, which I show in my main form.

So let's say here's what i want:
Sub Show_Control1()
UserControl1.Show
'CODE TO HIDE EVERY OTHER DISPLAYED USER CONTROL ON THE MAIN FORM
End sub

Right now I have to hide them one by one with hide, because I don't know what's the current displayed form.

View 2 Replies

VS 2005 User Cannot Select Anything From The Main Form Until The Have Logged In?

Mar 28, 2009

Is it possible to be able to have a main form load, but then have a logon form load on top of it and the user cannot select anything from the main form until the have logged in.

View 4 Replies

Access GUI Control Methods From Different Thread?

Aug 2, 2009

I have troubles with processing callback method invoked from a C++ DLL. Imagine: there is a ListBox on a Form; I wish to fill it with Items from callback. In Debug mode, I got a System.InvalidOperationException, because I access ListBox methods from different thread

View 2 Replies

VS 2010 Error - Cross-Thread Operation Not Valid: Control TbPlaca1 Accessed From A Thread Other Than The Thread It Was Created On

Aug 13, 2010

In one application, I need use 4 simultaneous threads.When the threads finished, I need to update the text of a TextBox.So, I create 4 Textbox, and I wanna the threads change the text to FINISHED.Each thread change one distinct TB.I use this "example"

Dim Terminados As Integer = 0
Private Sub frmEnviarMensagem_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Timer1.Enabled = True
Timer1.Start()

[code]....

The problem is, I have an error in the red lines.The error is: INVALIDOPERATIONEXCEPTION "Cross-Thread operation not valid: Control tbPlaca1 Accessed from a thread other than the thread it was created on."I don't use cross threading. Each TB only was accessed for the correspondent thread, and for the "main program".

View 3 Replies

Cross-thread Operation Not Valid: Control 'Panel1' Accessed From A Thread Other Than The Thread It Was Created On." ?

Nov 3, 2011

This is the error message I am getting:

"Cross-thread operation not valid: Control 'Panel1' accessed from a thread other than the thread it was created on." The reason I am getting this error is because I am opening up a new form and then calling these three things:

Panel1.Show()
Label1.Show()
Label2.Show()

why I get this error message because it doesn't occur normally if I open Form2 after closing Form1, it only occurs when I open Form2 after closing Form4.

View 4 Replies

Error - Cross-thread Operation Not Valid: Control 'txt1' Accessed From A Thread Other Than The Thread It Was Created On

Jul 21, 2009

I have done a program using vb2005 to display reading from my microcontroller bs2 board but have encountered some problems. My code are as follows.

Dim Stop_Rx As Boolean
Private Sub btnRead_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRead.Click
SerialPort1.Open()

[code]....

I've encounter an error which is, (Cross-thread operation not valid: Control 'txt1' accessed from a thread other than the thread it was created on.)

View 7 Replies

Error : Cross-thread Operation Not Valid: Control 'l_users' Accessed From A Thread Other Than The Thread It Was Created On

Jun 21, 2012

When my client try to connect to server I'm getting this error : Cross-thread operation not valid: Control 'l_users' accessed from a thread other than the thread it was created on.

Private Sub _socketManager_onConnectionAccept(ByVal SocketID As String) Handles _socketManager.onConnectionAccept
l_Users.Items.Add(SocketID)
End Sub

View 3 Replies

Cross-thread Operation Not Valid: Control 'Autocad' Accessed From A Thread Other Than The Thread It Was Created On

Jun 6, 2010

I have written an application that loads a form - frmCad as well as AutoCad. It does this via a class which detects when AutoCad quits.

Friend Class CadApp Private WithEvents AppObject As AcadApplication... Private Sub AppObject_BeginQuit(ByRef Cancel As Boolean) Handles AppObject.BeginQuit RaiseEvent Quit() End SubEnd Class

My main class loads frmCad as well as CadApp.

Public Class Cad Private WithEvents frmCad As CadForm Private WithEvents app As CadApp... Public Sub ShowForm() If frmCad Is Nothing Then frmCad = New CadForm frmCad.Visible = True End Sub... Private Sub app_Quit() Handles app.Quit frmCad.Dispose() frmCad = Nothing .... End Sub

When I debug the program, it stops at frmCad.Dispose()The program continues to execute, but all the code after it fails to work.Looking more carefully I get an error message which contains:-Cross-thread operation not valid: Control 'Autocad' accessed from a thread other than the thread it was created on.

View 4 Replies

Cross-thread Operation Not Valid: Control 'label2' Accessed From A Thread Other Than The Thread It Was Created On?

Feb 9, 2011

My error:Cross-thread operation not valid: Control 'label2' accessed from a thread other than the thread it was created on. I want to be able to give my Public RunBot() sub access to edit Labels, buttons, etc without an error.

[Code]...

View 8 Replies







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