|
My code was absolutely stupid and unnecessarily complicated. Brain fart...
This is the new code sample for anyone interested.
public class MainForm
{
WaitForm waitForm;
MainForm()
{
backgorundWorker1.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bWorkerCompletedHandler_AllReports);
}
button1_ClickEventHandler(object sender, EventArgs e)
{
waitForm = new Waitform;
waitform.Show();
backgroundWorker1.DoWork += new DoWorkEventHandler(bWorkerHandler_Option1);
backgroundWorker1.RunWorkerAsync(ReportCategory1Object);
}
void bWorkerHandler_Option1(object sender, DoWorkEventArgs e)
{
Foo(e.Argument);
}
button2_ClickEventHandler(object sender, EventArgs e)
{
waitForm = new Waitform;
waitform.Show();
backgroundWorker1.DoWork += new DoWorkEventHandler(bWorkerHandler_Option2);
backgroundWorker1.RunWorkerAsync(ReportCategory2Object);
}
void bWorkerHandler_Option2(object sender, DoWorkEventArgs e)
{
Bar(e.Argument);
}
void bWorkerCompletedHandler_AllReports(object sender, RunWorkerCompletedEventArgs e)
{
backgroundWorker1 = new BackgroundWorker();
backgorundWorker1.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bWorkerCompletedHandler_AllReports);
waitForm.Close();
}
void Foo(object Something)
{
}
void Bar(object AnotherThing)
{
}
}
|
|
|
|
|
hi to all..i need some help on how to access my ip camera in order to display stream on picturebox..please do help me... my camera has an ip 192.168.8.1..it can also be accessed through firefox by http://192.168.8.1 ..this is also my code,when i click the button, the picturebox should show the stream from the camera, but nothing happens..i am also using aforge.net library..
please check my code.. what do i missed? any help is greatly appreciated..thank you..
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using AForge.Video;
namespace cameratest
{
public partial class Form1 : Form
{
MJPEGStream stream = new MJPEGStream("http://192.168.8.1");
public Form1()
{
InitializeComponent();
}
private void video_NewFrame(object sender, NewFrameEventArgs eventArgs)
{
pictureBox1.Image = eventArgs.Frame;
}
private void Form1_Load(object sender, EventArgs e)
{
stream.NewFrame += new NewFrameEventHandler(video_NewFrame);
}
private void button1_Click(object sender, EventArgs e)
{
stream.Start();
}
}
}
|
|
|
|
|
You already asked this in QA: how to access an ip camera using c# and display stream on picturebox?[^] - don't post it in multiple places, it duplicates work and wastes time. That makes it rude!
Remember it's a weekend, so there are a lot less people here than normal so responses will take longer.
If you get an email telling you that you can catch Swine Flu from tinned pork then just delete it. It's Spam.
|
|
|
|
|
Sorry..i wont do it again..
|
|
|
|
|
hello every one i was a question about "property of network base software"
anybody can help me?
thank you....
|
|
|
|
|
Sorry but that makes no sense at all; please try rewording your question.
|
|
|
|
|
Excuse me,I want to learn about network software and how network software programing...?
-these software how to work?
and other questions...
|
|
|
|
|
First, you have to understand networking, which it doesn't sound like you do.
Read[^]
|
|
|
|
|
I have a OpenOffice Excel Sheet
that contains State,District,Taluka,Zone,Region and Territory
exprot these file into datatable or dataset
How it possible.
and while using open office in .net that contains any separate assembley.
Please give my full information.
|
|
|
|
|
You can read these into a dataset directly using OleDB; see these links[^] for some samples.
|
|
|
|
|
am using oledb
but am getting error
which assembly i need to use for OpenOffice.org 3.3
private void button1_Click(object sender, EventArgs e)
{
try
{
System.Data.OleDb.OleDbConnection MyConnection ;
System.Data.DataSet DtSet ;
System.Data.OleDb.OleDbDataAdapter MyCommand ;
MyConnection = new System.Data.OleDb.OleDbConnection("provider=Microsoft.Jet.OLEDB.4.0;Data Source='c:\\csharp.net-informations.xls';Extended Properties=Excel 8.0;");
MyCommand = new System.Data.OleDb.OleDbDataAdapter("select * from [Sheet1$]", MyConnection);
MyCommand.TableMappings.Add("Table", "TestTable");
DtSet = new System.Data.DataSet();
MyCommand.Fill(DtSet);
MyConnection.Close();
}
catch (Exception ex)
{
MessageBox.Show (ex.ToString());
}
}
I am getting Microsoft.jet.OLEDB not registered error
Please Help me For the above Problem
|
|
|
|
|
allasanthosh wrote: I am getting Microsoft.jet.OLEDB not registered error You need to download it from the Microsoft website[^].
|
|
|
|
|
The Jet provider won't work if you're running this code on a 64-bit machine. Jet is 32-bit only.
So, you either have to install the 64-bit ACE engine, downloadable from here[^] or go into your project properties and set the Target CPU to "x86" instead of "AnyCPU". That will force your code to run as a 32-bit application.
|
|
|
|
|
I am working with shape files using windows application
my requirements are
1.excel sheet contains state,district,taluka,region,zone,territory
- export data from excel sheet to datatable/dataset
-Create shape file
-create three columns in shape file automatically
-compare taluka-region
taluka-zone
taluka-territory
only maching values we have to store already created three columns
Please any body help me for this requirement.
Thanks
Santhosh
|
|
|
|
|
Help you with what?? What part of this are you having a problem with??
|
|
|
|
|
loading excel sheet data in data table
and i dont know creation of shape files
and total part of that question
|
|
|
|
|
Is there ANY part of this you have a clue about? If not, you're in trouble before you even get started.
You can start with this[^]
|
|
|
|
|
I have recently started to multithread my program and everything seems to work fine with the exception of a form I use to track the progress of data being transfered.
The Progress form is on the main thread, I send data to it as my program is processing it. The problem is that is does not appear on the form, I have used various methods to Invoke the thread but it just goes into a loop and never stops or just goes into oblivian. Some of the methods are as follows or similar:
public void UpdateStartTime(String text)
{
if (textBoxStartTime.InvokeRequired)
{
UpdateStartTimeCallback updateStartTimeCallback = new UpdateStartTimeCallback(UpdateStartTime);
Invoke(updateStartTimeCallback, new object[] { Text });
}
else
{
textBoxStartTime.Text = text;
}
}
and
public void UpdateStartTime(TextBox textBox, String text)
{
if (textBoxStartTime.InvokeRequired)
{
textBoxStartTime.Invoke(new Action<TextBox, String>(UpdateStartTime), new object[] { textBox, text });
}
else
{
textBoxStartTime.Text = text;
}
}
I also tried a delegate but it just does not see the other thread, I have verified the thread numbers are different and they're being used, it just doesn't make the connection.
Any ideas or suggestions will be greatly appreciated, thanks in advance.
Michael
modified 8-Feb-13 17:41pm.
|
|
|
|
|
try like this.
define a simple delegate in your class and call it like below.
delegate definition
public delegate void StatusUpdateHandler(string status)
use the delegate in your application like this
public void UpdateStartTime(string text)
{
if (this.InvokeRequired)
{
BeginInvoke(new StatusUpdateHandler(UpdateStartTime),new object[]{text} );
}
else
{
textBoxStartTime.Text = text;
}
}
Jibesh V P
|
|
|
|
|
I tried the above exactly as shown, however it does not return to the method. Any other ideas.
|
|
|
|
|
That's the standard pattern. If it's not working, there's something you haven't told us and/or are not showing us.
The code listed in the first reply is the way to do it, so long as the controls were created on the UI thread and your long-running code is on a different thread, be it directly launched with the Thread class, a Task or in a BackgroundWorker.
|
|
|
|
|
Hello Experts,
one of the console applications I wrote is about to get modified to do a similar job to the one it was first designed to do.
Its command-line parameters parsing works. But I never have been really happy with it. This example
tool.exe SetDo FirstLed On should make an attached device switch its first LED on, obvisously. And it does so.
What bothers me is that SetDo has to be the first parameter, FirstLed the second and On the third. No way for the user to put an option before SetDo .
Since the modifications will change the possible actions anyway, I thought of finding a more standard library instead of using my own parsing.
First I checked the GNU getopt .NET port[^] and found using it horrible. You have to specify a format string, only for one-character options and a switch statement that matches the format string. Then you can attach long options that use a short option to determine what action they trigger.
That approach appears to be inspired by sprintf's format string[^], which we all know about and that it works. It just is so unintuitive to use from a programmer's point of view.
My second try was Mono.Options[^]. It doesn't require a format string. You just have to fill a generic list with one object per supported command. Short and long option names are supported in the object's constructor, along with a description of the command (for the auto-generated help screen) and a method to call during runtime.
Now I recognize that there's still a lot of work to do by hand since not all my options are boolean switches. The example I gave above uses two enumerations, one that holds all possible digital outputs to manipulate, the other for the state that should be the result of the manipulation. It doesn't look like there is an easy way to get that into the auto-generated help file, nor that the parser can handle situations like "Option A must preceed one of enum B's values followed by enum C's values", does it?
Does anyone know of a command-parsing library suitable for that?
Or should I rather tweak the working one into having my options position-independent?
Ciao,
luker
|
|
|
|
|
|
No other responses?
Having given it some more thought... If I understand you correctly, you are using Enumerations for each parameter. Why not put them all in one enumeration?
|
|
|
|
|
Why? You covered it with that huge pile of links to various libraries!
|
|
|
|