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


ADVERTISEMENT

Multi-threading Forms - Open A Separate Form As A Separate UI Thread From The Start Up Form

Oct 27, 2011

I have a few forms that have a lot of really intensive updating along with a great deal of user interface (text boxes, button clicking etc) Is it possible to open a separate form as a separate UI thread from the start up form that called it to "show" or open or whatever the new method might be?

View 6 Replies

MS ACCESS/ Save And Load Database From Main Form To Child Forms' Datagridview

Jun 10, 2010

I build my project and i got some problems. First i want to print barcode for books(toolstripmenu item). but i cant. here's the code that i found:

[code..]

second problem is printing again. i want to print my MS ACCESS .mdb from child datagridview's records.

third one i want to save and load(with dialogs) my database from main form to child forms' datagridview.and the last one is help provider. i prepare my own .htm help file, when press F1 it opens. but i dont know how to call provider to toolstripmenuitem and help provider keep my computer's path so when i call provider another computer, the programme cant find the path.

View 10 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

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

Handle Events From The Main Form In A Separate Class Or Module?

Feb 24, 2012

I've been searching for the answer for a while but can't find it yet. Basically so far I have a simple VB.Net form with one button.I would like to make a class or module that can handle events from the main form. This is my code so far but it doesn't seem to work.

View 6 Replies

Create New Form On Separate Thread?

Jan 10, 2010

I would like my application to do something (in one form) and while form is doing that i would like to show another form to the user. Code is:

Private Sub blaa()
Dim a As New Working() 'working is another form
a.Show()
'Do some stuff
a.Close()
End Sub

But when i make new form i find it is on the same (main thread) and therefore new form also frozes. How to make new form on separate thread?

View 4 Replies

Update A Form From A Separate Thread?

May 9, 2010

I've looked at the on line doc over and over, and I can't seem to figure out why this won't work. This code runs the thread, and the thread seems to execute the code in the 'threadsafe' sub, however neither the progress bar is updated or the button click performed.

Imports System.Threading
Public Class VisNotify
Inherits Form

[Code].....

View 4 Replies

Separate Thread Accessing To Main Ui Controls?

Aug 25, 2009

how to access the main ui's labels from a delegate method?

View 7 Replies

Doing Work In Separate Thread To Prevent Form From Hanging

May 9, 2011

I have a really simple form with a button that fires a Sub I created which gathers data from ActiveDirectory and adds it to an Excel Sheet. The problem is, when I click this button the whole form hangs. So I figured the operation that gathers the data and adding it to the Excel sheet should be run in it's own thread, so that the form won't hang. Possibly it would be great to add a progressbar as well. The progressbar however is located at the Main userform that starts up once the projects is run.

I've got one MainForm.vb and one CodeFile.vb. I want most of the code in the CodeFile.vb so it's tidier.
MainForm.vb
Imports User_edit.CodeFile
Imports System.ComponentModel
Public Class MainForm
Private Sub btnImportData_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnImportData.Click
[Code] .....

Notice the ExportFromAD Sub I've got in the CodeFile.vb. This is what is actually doing the work. In the For each loop that adds data to the Excel is where I've put the MainForm.MyBackgroundWorker.ReportProgress(i * 10). Problem is, it doesn't actually update the label on the form. Which I find pretty weird because the form isn't really hanging or anything. Is it trying to access a different thread or something? Meaning, the form is run on it's own thread which can't be accessed from my second thread?

View 2 Replies

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

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

Detail Bound Form Updates Main List Form, But Does Not Update Data

Jan 29, 2010

I have a main form with datagridview containing a list of contacts:

VB
Public Class Form1
Private Db As New DataClasses1DataContext
Private Sub Form1_Load

[Code]....

After saving, I get the correct message ("Saved"), and the DataGridView in the first form gets updated in real time.

But... when I take look at the data (or close and reopen the forms) the data in the database (SQL server) have not changed! What happens!

View 4 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

Change Form Focus In The Main Load Event?

Jul 7, 2009

I have an application with a main menu.

File , Menu B, Menu C ....
-1
-ServiceMenu

When the user run the application I would like to show the File menu->ServiceMenu form and the main menu should be allways on the background. I try the following: From the main menu load events call the ServiceMenu routin.

Private Sub ServiceMenu()
Dim szt As New sztetelek
Me.AddOwnedForm(szt)

[code]....

My problem the following the new ServiceMenu (szt form) show in the right position but cannot get focus. My user have to click on it to the form gets the focus however if the user click the File-ServiceMenu this forms works well and get the focus.I think the main menu get back the focus (If i press the ALT the File menu dropdown .... )

View 6 Replies

Forms :: Load Progress Bar On Separate Thread?

Apr 29, 2010

I have created a form in which i am loading thousand of records. so i want to display a progress bar.Actually i am moving from MDI main meny to some other form so when i click that menu item i want to progress bar till my total records are not loaded.

View 3 Replies

Filling A Form From Data On Main Form?

Mar 9, 2011

I have a form called ExsistingClient on this form is a datagridview when I double click the datatgridviewrowheader I want it to get the clientid from the datagridview and use that to open and populate a form called ClientMainForm.The datagrid is populated from table called ClientData, the form ClientMainForm will be populated from table called PaymentData. The tables have a relationship on clientid fields.On the ExsistingClient form I have this code:

Private Sub Client_DataDataGridView_RowHeaderMouseDoubleClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellMouseEventArgs) Handles Client_DataDataGridView.RowHeaderMouseDoubleClick

[code].....

View 5 Replies

Make A Shared Function For Form Load In A Separate Class File?

Jan 9, 2012

i would like to have a shared function in a separate class file to address the form location . but i dont know how can i get this to work. if i use this below code in my form its working . but i cannot move this to a class file.

Shared Sub Formlocation()
Me.StartPosition = FormStartPosition.Manual
Me.Location = Screen.GetWorkingArea(Me).Location
End Sub

View 2 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

VS 2008 Load A Control On A Form In A Different Thread?

Aug 30, 2009

just wondering if it is possible to have a form and then load up a control on that form but so it runs in a different thread to its parent... i tried:

[Code]...

But it still seemed to be running on the form's thread And just so you know ctlMTTest is just a control that has a button on it, that, when you click the button, a loop runs.

View 1 Replies

VS 2005 Fetch Data From The Database And Filling It To The Combobox Dropdown List At The Form Load Event

Aug 29, 2009

This is the code that i did to fetch data from the database and filling it to the combobox dropdown list at the form load event:

[Code]....

View 14 Replies

Mdi Child Form Order - Move The New Form Behind The Main Form While It Loads

Aug 5, 2010

i have my main child form open. then i show the new form:

[Code]...

but when the form opens it flickers a lot. so i want move the new form behind the main form while it loads so the user does not see the flicker. once it is done loading i will set the form to topmost. how do i move the new form behind the main form?

View 12 Replies

Creating A Thread For Reading And Analyzing A Big Text File On Form Load Event

Jun 17, 2012

All the code i found for multi-threading is complex and not clear.What i want to do is creating a thread for reading and analyzing a big text file on Form_Load event, so that the form UI building continue without waiting for reading and analyzing the file finish.

View 2 Replies

TopMost Form - Messages Form Would Be Hidden By The Main Form

Nov 20, 2009

I have a tool window that I want to stay above the main application form, but not stay on top of all windows forms. Similar to the floating properties window for visual studio - it always stays on top of the main VS window, but if I select another program, like internet explorer, the floating properties window will be behind internet explorer.

What I have is an application that has several forms that may be displayed at the same time. I have a Messages form that displays messages generated by the code in the form, that gives the status of the application. Obviously, the user would not normally be working on this form, but they may want it to be visible to see the status messages from the program (File saved confirmations, etc). So, my two options right now are I can set the form to be on top of all other windows forms or, when the user clicks on the main application form, the messages form would be hidden by the main form.

View 6 Replies

Opening Form Bound To Main Data

Jan 3, 2012

I have a form which has my main data. On the form is a button to open another form called AccountNotes.

The table keys are as follows:
tblAccounts
pkAccountID
AccountDetail
etc etc

tblAccountNotes
pkAccountNotes
NotesDetail
fkAccountID

When I open the form AccountNotes how do I ensure it is tied or bound to the main form record I am viewing?

View 2 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

Plot Serial Data In Separate Thread?

Dec 29, 2011

my application receive data from serial port and store it in ConcurrentQuequeFor not lost any data from serial port I need to plot it in a separate theadin SummaryForm Load = set all parameter of ZedGraphPulsante Start = Open serial Port and start Thead

View 5 Replies

Load Data From One Form In Another Form?

Jun 30, 2008

On one form (form1) i have a simple textbox. On the other form (form2) i have 1 combobox and 1 textbox. The combobox and textbox are binded together to a datatable.

What i wan't is that when form2 loads firstly it shows the data from the textbox on form1. And when i select another value wit the combobox it shows the new data from the textbox on form1 to form2.

My problem is when form2 loads firstly no data is shown in my textbox. Why not???

I have the folowing code:

My.Forms.Form1.BedrijvenTableAdapter.Fill(My.Forms.Form1.Docregdata2DataSet.Bedrijven)
My.Forms.Form1.BedrijvenBindingSource.DataSource = My.Forms.Form1.Docregdata2DataSet.Bedrijven

[Code].....

View 7 Replies

Load The Sub Main At The Start Rather Than Loading A Form On Start Up?

Feb 24, 2012

How can I get my application to load the Sub Main at the start rather than loading a form on start up.

I have tried declaring 'Public Sub Main' on my forms and in some modules, yet in my project properties, it is not one of the options.

View 12 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







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