473,378 Members | 1,580 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Instantiating oneself

I defined a form object with databinding: frmDisplay. When the dataset of
that form has displayed its content 5 times, I need to instantiate a new copy
of the form and display that content. Here is what I have:
private void timer1_Tick(object sender, EventArgs e)
{
if(this.msgCount==5)
{
//suspend layout updates and play critical messages
//the next one throws an unknown object error when closing
Application.Run(new DisplayInfoScreen.frmDisplay("Critical"));
msgCount = 0;
}
else
{
//check for position at end of loop
if(this.BindingContext[objdsActive,"Message"].Position ==
(this.BindingContext[objdsActive,"Message"].Count - 1))
{
//reset loop to start of messages if at the end
this.BindingContext[objdsActive,"Message"].Position = 0;
msgCount += 1;
}
else
{
//advance step through to next message
this.BindingContext[objdsActive,"Message"].Position += 1;
msgCount += 1;
}
this.objdsActive_PositionChanged();
}
}

The timer objects work as Timer1 or Timer2 depending on how the form was
started (plain or critical message) and it does play, but when the critical
messages are done, the form cannot close and dispose. I'm adding more debugs
into it now, but the error just says "no object". I'm thinking it's because
the form doesn't return control or resume in the original form.

The other way I can think to do it is as a new form or clearing the current
ds and merge the new and bring back the old. Seems overly complicated and
processor intensive.

Maybe remove the object definition from the main thread of the application
so it's basically timers and SELECT statements being passed to a form object?

The form takes nothing or a string arguments to initialize:
static void Main(string[] args)
{
if(args.Length == 0) {
//run standard display
Application.Run(new DisplayInfoScreen.frmDisplay());
}
else
{ //run critical information display
Application.Run(new DisplayInfoScreen.frmDisplay("Critical"));
}
}

I've not done this in C# before. I appreciate some direction. I'm sure it's
a fundamental design issue.

Thanks,

E.
Nov 16 '05 #1
0 857

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: SammySAm | last post by:
I have a set of XSD's that I have to instantiate at run time and pass some values in C++.Net. How can I acheive it? Please advice. Best, Sam
2
by: HarishP | last post by:
Hi, How to avoid instantiating the class more than 10 times Harish.P Sr. Software Engineer Comat Technologies Pvt. Ltd., Bangalore Email: harish.p@comat.com
4
by: Tom | last post by:
I have a VB.NET framework 1.1 application that I am installing on my user's workstation. It works fine on EVERY machine except for one - on this one machine it generates a 'Overflow or underflow in...
1
by: Marja Ribbers-de Vroed | last post by:
I've been provided with a custom ActiveX DLL (written in C++) that reads a certiifcate to generate a signature for a passed XML string, and I'm having trouble instantiating it. The DLL is registered...
3
by: Nagesh | last post by:
hi, I have seen the winvnc(tightvnc server) source code in this I seen that class member funtions are calling without instantiating the object i.e. like vncService::ShowDefaultProperties() where...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.