|
Take a look at ILMerge[^]
“Accept that some days you are the pigeon, and some days you are the statue” -- David Brent
Cheers,
Will
|
|
|
|
|
i have form1 do something. the time required to do is about 2 minutes.
i want to display a form(waiting screen) while form1 complete the task.
my idea is that:
before doing the required task,
- create a new thread.
- open the waiting form in the thread.
- start the thread
it works, but you can access the form1 during doing task.
any idea?
|
|
|
|
|
You can make your waiting form modal and show it in the main thread but process a task in a separate thread.
|
|
|
|
|
many thanks, but how close the modal after the process finished
|
|
|
|
|
Keep reference on the waiting form and close it at the end of the working thread:
private WaitForm waitForm;
private delegate void CloseWaitFormDelegate();
private void StartProcess()
{
Thread processThread = new Thread(new ThreadStart(Process));
waitForm = new WaitForm();
processThread.Start();
waitForm.ShowDialog(this);
}
private void Process()
{
CloseWaitFormDelegate closeWaitForm = new CloseWaitFormDelegate(CloseWaitForm);
Invoke(closeWaitForm);
}
private void CloseWaitForm()
{
if (waitForm != null)
{
waitForm.Close();
waitForm = null;
}
}
-- modified at 4:35 Monday 10th July, 2006
|
|
|
|
|
Hello
You can set the Enabled property of your first form to false; then make it true again when you finish your task.
Form1.Enabled = false;
Form1.ShowWaitScreen();
Form1.DoMyWork();
Form1.CloseWaitScreen();
Form1.Enabled = true
Regards
|
|
|
|
|
If you do a search in CodeProject for SplashScreen you will find an example in there of what you need to do.
|
|
|
|
|
Hi guys,
I have a combobox (DropDownStyle = DropDown). This Combobox is loaded with a DataSource and Display- and ValueMember set.
I can set a free text to the combo, but when I try to read it out again, it always reads an item that is part of the datasource.
How can I solve this? Can you add items to your datasource? Is there another way around this? Maybe one of my properties is set incorrect? (although I checked them and they seem ok).
This is the last bug I could find and tomorrow morning I only have about 1 hour to install and bugfix our application so I hope somebody can help me (pleasing my boss and client )
TNX!
I've found a living worth working for, but I haven't found work worth living for.
<marquee>
|
|
|
|
|
Hello
V. wrote: it always reads an item that is part of the datasource
I've tried your problem, but it didn't happen at all. Here is my code:
-Assume you have comboBox1 and button1 in your form-
public partial class Form1 : Form
{
ArrayList arr;
public Form1()
{
InitializeComponent();
arr = new ArrayList();
arr.Add("hello");
arr.Add("World");
arr.Add("is");
arr.Add("an");
arr.Add("old");
arr.Add("example");
comboBox1.DataSource = arr;
}
private void button1_Click(object sender, EventArgs e)
{
MessageBox.Show(comboBox1.Text);
}
}
When I press button1, it displays the current text just fine. So, where is your problem??
V. wrote: Can you add items to your datasource?
Data source is dealed with through the IList interface. so you can add items as long as you know the type of your list -strings, numbers, etc...-
eg.
((IList)comboBox1.DataSource).Add(comboBox1.Text);
But don't forget to refresh your ComboBox after adding items to the datasource.
Regards
|
|
|
|
|
|
I did it .
It took me some tries to find it, but it seems to work.
tnx a lot !!
DataView view = (DataView)mycombo.DataSource;<br />
DataRow r = view.Table.Rows[0];<br />
r[0] = mytext; <br />
r[1] = -1;<br />
((IList<DataRow>)mycombo.DataSource).Add(r);
I've found a living worth working for, but I haven't found work worth living for.
<marquee>
|
|
|
|
|
-i've seen that there're System.IO.Ports for serial port but it only has got in .net framework v2 but i've just got VS.net2003 framework v1.How can i do ?
-will VS.net 2003 be able to use .net framework v2.i downloaded a .net framework v2 and installed it but VS.net 2003 show that .net framework version is 1.1xxx. Why didn't it upgrade to a new version?
|
|
|
|
|
VS 2003 wasn't built to be used with future versions of the framework. You can download express versions of Visual Studio 2005 for free from the Microsoft site, to build applications for framework 2.0. If you are a professional developer you might want to upgrade to the pro version of VS 2005. Try out the Express to see if it fits your needs. You can have VS 2003 and VS 2005 installed side by side without problems.
---
b { font-weight: normal; }
|
|
|
|
|
There are several free RS232 port classes available on the web, one was even provided by Microsoft in their :shudder: Visual Basic .NET Resource Kit :endshudder: a few years back. I don't know if the code is still available, but basically all it does it call the Win32 API, which is all the System.IO.Ports classes do (take a look in reflector at them ).
The Welsh will always support two teams: The Welsh, and anyone playing England
|
|
|
|
|
I'm attempting to write a fairly complex data structure.
One part of the complexity is that all 8 data operations it supports delegate some code to virtual method.
This is by design because I want the user to subclass the data structure and be able to prevent changes to happen. and / or I want to notify observers.
The unfortunate side effect is: it seems there are no simple way to have all user code run at the begining or at the end of the code.
Hence some user code might be called in the middle of an operation and cause an unrecoverable error. (i.e. corrupt the data structure).
Do you think it's acceptable?
I am thinking there are 2 possibilities:
1. it's ok. Warn the user (in the documentation), these are critical data method, mess them, mess the data!
2. data structure should be fool proof, stack all user change in a class for this purpose and run them at the end
what do you think?
|
|
|
|
|
You can use next template in your structure to recover your data when user code throws exception:
public void SomeOperation()
{
try
{
SomeOperationBase();
}
catch(Exception)
{
throw;
}
}
protected virtual void SomeOperationBase()
{
}
Notice!
1. SomeOperation() is public and nonvirtual.
2. SomeOperationBase() is protected and virtual.
You can also use this template to solve this problem:
The unfortunate side effect is: it seems there are no simple way to have all user code run at the begining or at the end of the code.
-- modified at 4:51 Sunday 9th July, 2006
|
|
|
|
|
Thanks for answering!
Doesn't work though!
My Code is more like that:
void ActionImpl() { }
protected void Action(TextElement aParent)
{
foreach(TextElement child in this)
child.Action();
ActionImpl();
NotifyAction(this);
}
protected virtual void NotifyAction(TextElement aParent)
{
}
One problem is the recovering action has user notification too!
(in fact it just use the reverse operation).
So the recovering could fail to. (and then I have 2 exception which I should report to the user... which might be confusing).
So I decided I won't recover, I will just manage to have the data in a valid state, though neither the initial nor the expected final one.
An other case is:
protected void BigAction()
{
Action_1();
Action_2();
}
after Action_2() thrown an error I should undo Action_1(). But what if the undo throw an exception?
It's all clear to me now.
I should NOT recover.
That was my mistake.
I should report the exception straight away with as little change as possible.
However I should, at least, ensure valid (even though unexpected) internal data.
|
|
|
|
|
BTW my case is exactly the opposite. core work is NOT virtual.
Unfortunately I have virtual "notification" method (or sometimes event, but that lead to the same logical problem).
Which "might" throw an exception....
|
|
|
|
|
If there's a possibility that the user's code might corrupt the data (which is likely to be true if the data is not a read-only and user has sufficient rights to change it) - provide some way to the [b]user[/b] to handle it.
Don't try to recover data by your own means because obviously your code have no prior knowledge that might go wrong therefore there's no guaranty that you would be able to fix all the possible mess.
If there's no guaranty - don't claim it. Let the user's code do
all cleaning up/fixing job in a way he/she wants.
One thing that might be usefull is ability of making a copy of data so the user could try again if bad things happened with the original data. If it pays to make a copy of the data before potentially dangerous operation - let user do the decision.
The bottom line is - let the user decide is data was corrupted and if it was - let user's code recover from corruption.
Best regards,
-----------
Igor Sukhovhttp://sukhov.net
|
|
|
|
|
Exactly!
That was one of my mistake!
|
|
|
|
|
If i want to read a file from a ftp site, how can i do it.
|
|
|
|
|
|
Hello,
I have a treeview already populated with data. What I want to do now it to populate a listBox control with extactly the same data.
Let's say my treeView control contains the following items:
Parent
+ Son
- - Grandson 1
- - Grandson 2
+ Daughter
- - Grandson X
- - and so on...
I want to make my listBox items as follow:
- Son
- > Grandson 1
- > Grandson 2
- Daughter
- > Grandson X
- > and so on...
I don't know how many level I'll have at design-time.
Please help. Thanks.
|
|
|
|
|
Use recursion. Something like this:
private void FillListBox()
{
foreach (TreeNode rootNode in treeView.Nodes)
{
AddSubtree(rootNode, string.Empty);
}
}
<p/>
private void AddSubtree(TreeNode node, string prefix)
{
listBox.Items.Add(prefix + node.Text);
prefix += '>';
foreach (TreeNode childNode in node.Nodes)
{
AddSubtree(childNode, prefix);
}
}
-- modified at 2:24 Sunday 9th July, 2006
|
|
|
|
|
Worked like a charm! Many thanks.
Can I ask you another question?
I have a self joined table named: Category. It contains 3 columns only: CAT_ID, PARENT_CAT_ID and Title. I'm using a data reader to get the categories from the database as follow:
while (dbReader.Read())
{
Title = (string)dbReader["Title"];
CAT_ID = (int)dbReader["CAT_ID"];
PARENT_CAT_ID = (int)dbReader["PARENT_CAT_ID"];
// MessageBox.Show(Title); <- Working!!!
}
Can you please tell me how can I populate a treeview recursivley with the data I pulled from the database?
I would appreciate any help.
-- modified at 3:08 Sunday 9th July, 2006
|
|
|
|