|
Excuse me, but where is located the HTML Help Workshop on the Visual Studio CDs? I tried with the standard installer but there is not. I searched on the CDs but I found only the HTML Help compiler, not the editor.
|
|
|
|
|
Have you guys ever realised that when you have a component class that has a timer, and when your Thread calling the method finishes off, the Timer events still gets fired.. Why is this so.. Look at the following code as an illustration.
public class WithTimer : System.ComponentModel.Component
{
private System.Timers.Timer timer1;
public WithTimer(){}
public void StartTimer()
{
int i=0;
while(true)
{
if(i==0)
timer1.Start();
i++;
}
}
}
public class MainApp
{
public static void Main()
{
WithTimer m_Timer = new WithTimer();
Thread _Thread1 = new Thread{new ThreadStart(m_Timer.StartTimer)};
_Thread1.background = true;
_Thread1.Start();
_Thread1.Abort();
}
}
Now as you can see in the code, after _Thread1.Abort(), i realise that m_timer events still gets called, even after the Thread has exited gracefully.
This ONLY happens with the Timer events. Anyone know why this is happening ?
Any solutions to this ?
Stanley
|
|
|
|
|
That's how Timers are supposed to behave, aren't they? They keep firing off events at regular intervals of time, until you call Stop.
By the way, why are you starting timers in a thread? Starting a timer is not going to take much time, you can do it in the main thread itself.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Reason being, I want to create a listener per thread.
Stanley
|
|
|
|
|
jbx1628 wrote:
Anyone know why this is happening ?
The Timer class creates a thread to run itself in. This obviously stays alive, but logically you would think if the thread that created it was aborted, it should abort any 'child' threads too. This doesnt seem to be the case though.
Now the solution should be:
override Dispose(bool disposing)
{
timer1.Dispose();
base.Dispose(disposing);
}
This should be called when the finalizer is called for the WithTimer either by calling Dispose() or letting it be GC'd.
xacc-ide 0.0.15 now with C#, MSIL, C, XML, ASP.NET, Nemerle, MyXaml and HLSL coloring - Screenshots
|
|
|
|
|
Yeah, this is my curiosity as well. I taught any if the parent thread gets created, all it's child will get NUKED. Thanks for pointing this out...
Stanley
|
|
|
|
|
How can i capture the net send packts using C#.NET or in any other language. kindly help me.
Thnaks in advance.
Shahzad
|
|
|
|
|
you have to sniff TCP packets, but I don't know how to do this in C#. try searching on CodeProject: I think there is something useful
|
|
|
|
|
Hi,
I have made windows service program
In On start code i am calling exe file through process.start
inside on_start()function
Process.Start(@"c:\a.exe"); here i do not want to write complete path
I want to write only a.exe and path should be taken from my other project which i made another installation program for this project.
How can i retrive the path of a.exe so that my windows service automatcally retrive the path of location of a.exe
Client can install set up program of a.exe in any drive.
In that case how my windows service will retrive the complete path of a.exe
Pls suggest in this matter
This is very urgent
THanks and Regards
sanjeev
Everything is possible
|
|
|
|
|
Just write the path where a.exe is being installed to into the registry: Add a new registry key to your setup for a.exe and set its value to [TARGETDIR] .
Regards,
mav
|
|
|
|
|
Say i had a main class like..
class MainClass : Form
and i had another class
class Control
can I add a function to an event handler through the Control class to the mainclass? if not is there a way around this? any solutions will be appreciated thx for the help.
IM PROUD TO BE A GMAIL;
|
|
|
|
|
If I am reading you correctly, then the answer is yes.
((MainClass) this.ParentForm).MyEvent += new ...
|
|
|
|
|
Hi everybody.
Can somebody direct me to a correct algorithm to solve the sort problem of the following array of data:
ServerWeb.*
ServerWebSomething1
ServerWebSomething2
ServerWeb3
ApplicationServer1
App.*
ApplicationServer2
should be sorted as this:
ApplicationServer1
ApplicationServer2
App.*
ServerWebSomething1
ServerWebSomething2
ServerWeb3
ServerWeb.*
The point is that the data is first sorted alphabetically, and then withing the similar types of data I need to get the data with more specific to the top and those less specific to the bottom.
For instance, as ServerWeb.* covers all servers that starts with the "ServerWeb" it is the least distinctive, while ServerWebSomething1 is the most distinctive in that subgroup.
This just puzzles me, I would appreciate any algorithm in any language if C# example is not available.
Thanks.
|
|
|
|
|
What you need to do is to define a way to compare two of the values. If you just do that, you can then use any sorting algorithm. You can even make a class that implements ICompareable and use the SortedList class to sort them.
What information does the names contain? How do you separate the different parts of information? Why is, for an example, "ServerWebSomething1" more distinctive than "ServerWeb3"?
---
b { font-weight: normal; }
|
|
|
|
|
I am having some problems adding dynamic MenuItems to a context menu in a C# Windows application. Look at the pasted code below. Click the Add Item button a couple times, then right click anywhere in the checked list box. List Items should expand with a list of all the items in the checked list box.
Now, click the button a couple more times and notice the change on the right-click context menu. List Items no longer expands!
I've also tried:
Clearing ListItems.MenuItems collection and re-adding new MenuItems on Popup
A static list of MenuItems added to ListItems.MenuItems in InitializeComponent, set visible or not depending on the number of items in the check box
Any ideas?
Compile the code with: csc /target:winexe MenuTest.cs
////////////////////////////////////////////////
// Begin Pasted Code Here
///////////////////////////////////////////////
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
public class MenuTest : System.Windows.Forms.Form
{
private System.Windows.Forms.Button AddItem;
private System.Windows.Forms.ContextMenu DynamicMenu;
private System.Windows.Forms.CheckedListBox ListBox;
private int ListItemCount = 0;
private System.Windows.Forms.MenuItem menuItem2;
private System.Windows.Forms.MenuItem menuItem3;
private System.Windows.Forms.MenuItem ListItems;
private System.ComponentModel.Container components = null;
public MenuTest()
{
InitializeComponent();
}
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
private void InitializeComponent()
{
this.ListBox = new System.Windows.Forms.CheckedListBox();
this.AddItem = new System.Windows.Forms.Button();
this.DynamicMenu = new System.Windows.Forms.ContextMenu();
this.ListItems = new System.Windows.Forms.MenuItem();
this.menuItem2 = new System.Windows.Forms.MenuItem();
this.menuItem3 = new System.Windows.Forms.MenuItem();
this.SuspendLayout();
this.ListBox.Location = new System.Drawing.Point(8, 32);
this.ListBox.Name = "ListBox";
this.ListBox.Size = new System.Drawing.Size(120, 94);
this.ListBox.TabIndex = 0;
this.ListBox.MouseDown += new System.Windows.Forms.MouseEventHandler(this.ListBox_MouseDown);
this.AddItem.Location = new System.Drawing.Point(32, 152);
this.AddItem.Name = "AddItem";
this.AddItem.TabIndex = 1;
this.AddItem.Text = "Add Item";
this.AddItem.Click += new System.EventHandler(this.AddItem_Click);
this.DynamicMenu.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.ListItems});
this.DynamicMenu.Popup += new System.EventHandler(this.DynamicMenu_Popup);
this.ListItems.Index = 0;
this.ListItems.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.menuItem2,
this.menuItem3});
this.ListItems.Text = "List Items";
this.menuItem2.Index = 0;
this.menuItem2.Text = "Here Is A List";
this.menuItem3.Index = 1;
this.menuItem3.Text = "-";
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(136, 189);
this.Controls.AddRange(new System.Windows.Forms.Control[] {
this.AddItem,
this.ListBox});
this.Name = "MenuTest";
this.Text = "MenuTest";
this.ResumeLayout(false);
}
#endregion
[STAThread]
static void Main()
{
Application.Run(new MenuTest());
}
private void AddItem_Click(object sender, System.EventArgs e)
{
this.ListItemCount++;
this.ListBox.Items.Add( "item" + ListItemCount.ToString() );
}
private void ListBox_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
{
if (e.Button == MouseButtons.Right )
{
System.Drawing.Point pt = new Point( e.X + 10 , e.Y + 25 );
this.DynamicMenu.Show( this, pt );
}
}
private void DynamicMenu_Popup(object sender, System.EventArgs e)
{
foreach( object o in this.ListBox.Items )
{
this.ListItems.MenuItems.Add( o.ToString() );
}
}
}
|
|
|
|
|
The problem is that you are not creating an instance of the menuitems. Use an ArrayList to store each new menu item. Also, it's best to add the menuitems in your method "AddItem_Click". So modify the AddItem_Click as follows:
<br />
ArrayList arr = new ArrayList(); <br />
private void AddItem_Click(object sender, System.EventArgs e)<br />
{<br />
this.ListItemCount++;<br />
this.ListBox.Items.Add( "item" + ListItemCount.ToString() );<br />
<br />
MenuItem mi = new MenuItem("item"+ListItemCount.ToString());<br />
arr.Add(mi);<br />
this.ListItems.MenuItems.Add(mi);<br />
}<br />
>/code>
|
|
|
|
|
I would like to send a string from one windows application to another.
Would anyone know how to do this using the SendMessage WinAPI function?
My attempts have failed so far.
|
|
|
|
|
Don't do it using the SendMessage method; that is for window messages.
Do you have access to the source code of both applications? If so, use .NET remoting or web services to pass a string.
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Conversation With a Muslim
Judah Himango
|
|
|
|
|
Thank you for the response.
Yes I have the source code for both apps. At present, the apps are just for test purposes. Trying to determine the best method for application communication.
I've had a quick look at remoting. I was unable to figure out how a remoting object is able to communicate / attach itself to an application?
The information I am trying to send across is to inform an allow the application to perform some work.
|
|
|
|
|
I'm programming a C# application and I have one thread making one operation.
This threads is called by a method.
When I use this method from the current Application, by means of a Button it works properly. But if I call this method from another thread the method works only if this thread still alive.
I guess that in the 1st case the threads parent is the application thread but in the second case the parent is the other thread.
I can see it because I generate a Form with this method/thread and it disapears suddenly when I use a thread for call it.
Some help??
PD: Sorry for my English
|
|
|
|
|
You'd need to state the problem more clearly.
From your description, it looks like you're trying to launch a Form from within the thread. Did you use Form.Show or Form.ShowDialog ? I suspect you used Form.Show , that's the reason it worked when invoked from a button. A modeless dialog requires a message pump[^] to be running on the calling thread. When you create one with a button click, it'll use that threads' message pump (which is what processed your message). When you create one in your own thread, you have to run the message pump yourself, like this
Form form = new Form();
Application.Run(form);
in your thread.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
I'm sorry but this does not works.
I cannot use the method ShowDialog() because I need the Form behaviour and use Aplication.Run(form1) throws a Exception.
...
Maybe I missunderstand your directions, but I think that there will be another solution using some thread properties.
Thanks for your advice.
|
|
|
|
|
Hi,
Is it possible in datagrid to assign a hidden tag for each row identify the AutoNumber ID from the database instead of displaying it as a column?
Best Regards,
Jassim Rahma
|
|
|
|
|
You can change that cell to be not visible in the DataItemBound method for your datagrid. Something like this....
<br />
private void DataGrid1_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)<br />
{<br />
e.Item.Cells[0].Visible = false;<br />
}<br />
Steve Maier, MCSD MCAD
|
|
|
|
|
I'm no longer using DataGrid because it was lacking so many features I needed such as setting row/cell keys conveniently. I'm currently using iGrid.NET from www.10tec.com. I'm very happy with it so far. Using this grid, I can easily set the row key like this: iGrid.Rows[row].Key = rowKey;
Glenn
|
|
|
|