|
Hi All,
I am trying to write an application like, that will do some jobs with the given time interval. Program reads from a text file, which like below...
-------------------------
job1 : 15 minute
job2 : 5 minute
job2 : 25 minute
program place a System.Timers.Timer() for each job, and add ElapsedEventHandler(OnTimedEvent); to do job. The problem is I could not tell the OnTimedEvent code what to do
private static void OnTimedEvent(object source, ElapsedEventArgs e)<br />
{ <br />
<br />
System.Windows.Forms.MessageBox.Show(null,"selam","naber"); <br />
}
how to set a parameter to pass this event an make it special for the job.
karanba
|
|
|
|
|
Derive a new timer from System.Timers.Timer and add a string (or any other data).
public class NewTimer : System.Timers.Timer
{
public string Name;
public NewTimer()
{
}
}
then use this class rather than System.Timers.Timer:
T1=new NewTimer ();
T1.Name = "Timer1";
T1.Interval = 4000;
T1.Elapsed +=new System.Timers.ElapsedEventHandler (this.vHandleTimer);
Then look at the NewTimer in your event hander:
private void vHandleTimer (object sender, System.Timers.ElapsedEventArgs e)
{
NewTimer T=sender as NewTimer ;
MessageBox.Show(T.Name );
}
Hope this helps!
Bill
|
|
|
|
|
Is it possible to add only the needed .NET dll's to an application as a resource to "pre-extract", so that a machine you are deploying your application to, does not need huge .NET framework installed for it to work? OR is there a way to capture the native code that the JIT compiles out of the MSIL and create a PE with it, or will something like that not include garbage collection, etc ?
|
|
|
|
|
|
Ahh, thank you very much sir! This is exactly what I was looking for and could never find.
|
|
|
|
|
Hi,
I am building a website which opens a site map in a child window (window.open - popup window) which displays in links to navigate for users.
How do i do this -
When the users clicks on the child window link, the parent window must load that particular page.
any suggestions? easy one i think...
|
|
|
|
|
Your question would be better handled in the ASP.NET Forum. Even though your app is being written in C#, it really has nothing to do with the language itself. Your question has everything to do with the ASP.NET technology though...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I thought u knew the answer! Rather than useless msgs you can post in the answer if you know!
$iva
|
|
|
|
|
He wasn't posting a "useless msg", he was politely pointing you to the correct place to post your question. I don't know the answer so i can't post what you want, but it looks like you haven't even taken the previous posters advice and posted your question on the ASP forums.
When someone is trying to advise you on how to get the quickest solution to what you want, you'd be better off taking there advice, rather than posting stupid replies like the one above.
Kev Pearman MCP
|
|
|
|
|
Another ungrateful S.O.B. has made it on to my BlackList!
Thankfully, this is a rare event and will not stop me from helping other people, like pointing them in the right direction, in the future.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
If I insert an image in the RichTextBox at runtime, can I drag/move it inside the RichTextBox with the help of mouse, just like we can move any control on the form during design time.
Please guide
|
|
|
|
|
I have a datagrid with this structure:
Column1 Column2 Column3
Name URL FilePathtoSaveTo
There are 1000 rows in the grid and I want to use the url (Column2) in an httpwebrequest and httpwebresponse to get web pages and then use the FilePathtoSaveTo (Column3) to write the web page to disk.
Anyone know of a foreach loop (or some other way) that will allow me to do this (return the cell values from columns 2 and 3 in order to be used as variables for my web request and write?)
Thanks,
Paul
(Also, the urls return text files that when saved with the .html extension, open as html files.)
|
|
|
|
|
Well WHAT is your data source for the Grid? You need to iterate over your data source, NOT the data grid
|
|
|
|
|
Sorry, it is a dataset.
The main point is that I want to take a record
then assign the value from that row, column2 to the variable that contains the url
and then assign the value from that same row and column3 to the variable that will hold the pathname.filename to save as.
I just haven't figured out exactly how to do it yet.
(I've actually got to run now, but I'll be back later tonight)
Thanks,
Paul
|
|
|
|
|
Something like this:
DataTable table = theDataSet.Tables[0];
foreach(Row aRow in table.Rows)
{
string Url = aRow[1];
string SavePath = aRow[2];
}
You can also use the name of the column instead of the ordinal position.
Does this help?
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
The Second EuroCPian Event will be in Brussels on the 4th of September
Can't manage to P/Invoke that Win32 API in .NET? Why not do interop the wiki way!
|
|
|
|
|
Roman Doug and Colin
Thanks to all of you.
This is very cool and it works great.
Thanks for pointing me in the right direction.
Paul
|
|
|
|
|
bool keepGoing = true;<br />
for (int rowNum = 0; keepGoing; rowNum++)<br />
{<br />
try<br />
{<br />
<br />
}<br />
catch<br />
{<br />
keepGoing=false;<br />
}<br />
}
This will probably work, but I don't particularly like it...if you have a dataset with the information, you might want to iterate through that instead of the grid itself.
- D
|
|
|
|
|
So I simply designate the cell by iterating over the rows and then designating the column like this dataGrid[rowNum][2]?
That simple?
I'm using a dataset.
Thanks,
Paul
(I've got to go now...be back later tonight.)
|
|
|
|
|
Actually, I messed the syntax up. You can get the value of a cell with:
dataGrid[rowNum, colNum]
I agree with the other post about using the dataset instead of the grid...but if you have to, you can use the grid. Keep in mind that if you use the datagrid instead of the dataset, you will have to find a way of counting the rows. This is why I used the try/catch block of stopping the loop in my example. I'm sure there are better ways...I'm just too lazy tonight to look anything up. Also, if you use the datagrid, you may have to check the values you get from the cells to make sure they are usable. If the grid is editable, you'll (almost) always have that extra row at the bottom that will have nothing, but you'll still be able to return the value from those cells.
Good luck!
- D
|
|
|
|
|
I have a C# application. This C# application also has file types associated with it (in my case, the extenion is .drb). I want to have a DIFFERENT icon compiled within my .exe that these file extensions use, however, I cannot figure out HOW to add additional icons to be compiled within my application for use by these extensions?
Am I making sense?
|
|
|
|
|
Add an icon file to your project, select the file in Solution Explorer and now in the Properties pane change the Compile property to "Embedded Resource".
After that follow standard procedure for adding file associations/icons.
|
|
|
|
|
That won't work. Embedded Resources != Win32 resources. The icons have to be accessible to Win32. Embedded resources are not.
See my reply to the poster if you want to know more information.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
The other reply wouldn't work. Embedded resources are stored differently than Win32 resources (in C/C++, these would be referenced in the .rc file).
There are many ways you can do this. You can use the command-line compiler (csc.exe) and specify the /win32res: switch along with the path to a .res file that contains your win32 resources. In Visual Studio 2005, you will be able to specify this in the environment, which wasn't available in Visual Studio .NET 2002 and 2003.
You can also - after compiling - open the executable (.EXE or .DLL) in Visual Studio. That will show you your resource section. You can import icons and other resources types into the PE/COFF executable (the executable format on Windows).
If you sign your assemblies (and there's no reason not to - it's easy), you should resign them to make sure the hash is correct (shouldn't be a problem, but follow along anyway). Use sn.exe -R MyApp.exe KeyPair.snk, where MyApp.exe is the assembly to be signed (of course) and KeyPair.snk is the path to the key pair you used to sign the assembly in the first place. Usually it's a good idea to enable delayed signing (using the AssemblyDelaySignAttribute ) and sign it later anyway, and if you use Authenticode to sign the assembly (the PE/COFF executable, actually) then you'll definitely need to resign it after modifying it (or just don't sign it before modifying it anyway).
Again, Visual Studio 2005 will include this functionality into the IDE, which will be nice.
Alternatively, you might consider just using a native resource-only DLL with the icons you want. Create a new (unmanaged) C or C++ DLL project, add your resources (icons, bitmaps, AVIs, etc.), compile and distribute. The only problem with this approach is that Fusion (the assembly binder which can work seemlessly over the Internet) won't grab it - it only works with .NET assemblies. With installation deployments or (presumably) ClickOnce - a new touchless deployment in .NET 2.0 - this won't be a problem.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi,
I want to export a report created with Crystal Reports 9 to Excel format with this condition :
I want to split the exported file into 5 files. First file for page 1 - 10, second for page 11 - 20, and so on.
What i want to know is, how can i set the number of pages exported without user interaction (by clicking export button in crystalreportviewer)?
Thanks for the help.
|
|
|
|
|
I'm thinking of writing a game in C# that have a "searching for
opponents" feature, like the internet checker included in Windows XP.
What do I need to do that? Since I'm directing searching for an opponent on the internet, so I don't think I need to have a server, do I?
Okay, but how?
|
|
|
|