|
Sounds like you need to add a database of some sort. No, you cannot do that.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Hi all,
using SHDocVw.InternetExplorer,(DOM)
How to identify the link, that is clicked in a page.
For an example if i click "Message Boards" in this page, then i have to capture the string of that link as "Message Boards"
Can someone help me.
thanks in advance
|
|
|
|
|
Hello,
I am a beginner to ASP.NET. I need some directions for this task.
Information about task:
Phase 1 : Assume Server whose health to monitor is GEMINI.
Create two unattended (non UI) Windows Services (or Windows exe) written in C#.
Every specific “duration” the windows services will be invoked.Use app.config file to store this duration value.
Should check the server (GEMINI) if it is up or down.
Check the following various applications under following broad classifications in the server.
Server
IIS
SQL Server
Windows Service ( control panel --> under services u see services running)
Windows Exe
Web Service
If the application is down and the server is down it has to log data into the sql server database.
Thanks in advance!
Ramito
|
|
|
|
|
ramindya wrote: I am a beginner to ASP.NET.
Apparently sufficiently so that you could not find the ASP.NET forum.
ramindya wrote: Assume Server whose health to monitor is GEMINI.
Create two unattended (non UI) Windows Services (or Windows exe) written in C#.
Every specific “duration” the windows services will be invoked.Use app.config file to store this duration value.
Should check the server (GEMINI) if it is up or down.
Check the following various applications under following broad classifications in the server.
Server
IIS
SQL Server
Windows Service ( control panel --> under services u see services running)
Windows Exe
Web Service
If the application is down and the server is down it has to log data into the sql server database.
This is NOT a beginner task. It's also not an ASP.NET task ( so you are in fact in the right forum ).
There's two possibilities here that I can see.
1 - you are doing a course. If so, this course is INSANE, to give you a task like this, when you're a 'beginner', to the point that you can't even tell if this is an ASP.NET task or not. Quit the course.
2 - you've been given this task as part of your job. In which case, you and the people you work for, are immoral, dishonest thieves. If you don't know how to do it, don't accept the work.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Hi,
I have a windows form app which downloads attachment in outlook emails on a button click event and shows the contents to the users. The attachment which I am reading is an Excel file.
Recently I came across the background worker class which operates on a different thread other than the main process thread. I would like to know how to automate the button click event into a new thread...so that the user doesnt need to click on it to download attachments everytime and get displayed data.I want this to happen automatically. (by removing the button click event)
I want the app to check for new emails every 5 minutes(maybe by using System.timer .. etc) and download and process any email with excel attachment and display to the user. without the user getting interrupted while the application is downloading and processing the excel. How do i go about doing this using the background worker?
Suggestions appreciated...
Thanks
|
|
|
|
|
Hi,
you could organize it like a simple loop (pseudo-code):
for(;;) {
...
Thread.Sleep(5*60*1000);
}
All this could reside inside the DoWork handler of a BGW.
Alternatively, you could just use a System.Timers.Timer, that would cause your code (without loop and sleep!) to run periodically, with the risk of one iteration taking too long and being overrun by the next.
For both of these, you are not allowed to directly touch any GUI Controls, you need Control.Invoke; see here[^] for details.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Hi thanks for ur answer,
I would like to call the Thread.Sleep(5*60*1000) after the execution of runWorkerCompleted. This is because in the DoWork it is downloading the attachments ,,,but waiting for the specified time before displaying data.
|
|
|
|
|
Hi,
the last thing a BGW does is make sure RunWorkerCompleted gets called; this event runs on the GUI thread, you are not allowed to do any Thread.Sleep in there as that would block the entire GUI. However you are allowed to start a (5-minute) timer there.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
modified on Thursday, August 20, 2009 9:33 PM
|
|
|
|
|
For something like that I have used a System.Timers.Timer, but I've also left the button in case the user gets impatient.
(I also allow the user to specify the period or disable the periodic check.)
|
|
|
|
|
To add to the excellent answers you already have...
If you have code inside the button click that you don't want to duplicate or refactor into a separate method, Button has a PerformClick method that you could call from the timer so there would be no difference at all between the user clicking it and your code 'clicking' it.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
Thanks ppl, for all your answers. Appreciate it
|
|
|
|
|
yeah that could be done, but what if the user is currently using the system and the the perform click event occurs after the timer, it would interrupt his work. !!
|
|
|
|
|
It doesn't take control of the mouse and click the button! It just calls the Button's protected OnClick method internally.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
Hello Everyone-
I'm learning C#. I am working with adding some images into an application now, for example, on a button. When I select Image, I am presented with a couple of options. I can import an image under "Local Resource" or I can import the image under "Project Resource File". I am wondering what the difference is between the two, and which one I should be using?
It appears that when I select an image to be imported into the project resource file, the next time I compile it, the executable is bigger, so I'm assuming that the images are compiled into the exe? (Ie, so I do not have to distribute individual image files with my application??)
Thank you!
|
|
|
|
|
Yes, the image is compiled into the .exe (in both cases).
A "Project Resource" is shared between all forms in the project, so you can reuse the image in multiple forms.
A "Local Resource" is available only in that single form. You could create multiple local resources with the same image, but that would embed multiple copies of the image in your .exe.
|
|
|
|
|
Ahh! Makes perfect sense! Awesome, thank you!!
|
|
|
|
|
Daniel Grunwald wrote: A "Project Resource" is shared between all forms in the project, so you can reuse the image in multiple forms.
A "Local Resource" is available only in that single form. You could create multiple local resources with the same image, but that would embed multiple copies of the image in your .exe.
Thanks!
Neat, I never knew that. I always just picked "Project resource". That worked, so that was good enough for me.
|
|
|
|
|
But
If you import image from Project Resource File, your Application will NOT RUN after Dotfuscator.
If you import image from Local Resource, your Application will RUN OK after Dotfuscator.
|
|
|
|
|
Is there any way to draw high quality text glyph by glyph using GDI+?
When we draw a String using GraphicsPath.AddString, The SubPathes in the main path are glyph outlines. but it seems in small fonts the quality of Drawing string this way is not acceptable.
Is the result of GraphicsPath.AddString equal to GetGlyphOutline API function?
any help will be appreciated
|
|
|
|
|
Hello. I've done a lot of searching on how to covert text to a wav file using C# and have been able to get it working. However, it seems that when i play that wav file (i've tried it with WinAmp and Windows Media player), it plays at a lower volume than an mp3 file. I've tried setting the volume of the SpeechSynthesizer to 100 but it still doesn't play at the same level as an mp3 file. Can anyone help with this or steer me in a direction? Thanks in advance.
|
|
|
|
|
The volume of WMP is the same, what is different is the level in your wav file. You can use filters to increase that level, but you'd do better to change your existing code to record at a higher level, if you can.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
How can I convert Glyph Index to Unicode encoding?
The GetCharacterPlacement API function is useful for convert a sequence of unicode carachters to Glyph Indices, but is there a solution for convert a sequence of Glyph Indices to unicode carachters?
any help will be appreciated.
|
|
|
|
|
it has problay discussed lots of times before, but i can't find the solution.
private void button1_Click(object sender, EventArgs e)
{
Form2 mw2 = new Form2();
mw2.Show();
}
this way keeps creating new instances of the same class and therefor new windows/forms.
i would like to do it as in the code below, create only one instance and keep it active and if i like to see it, make it visisble again.
i would like to creatre a sort of test window, where i can see in a richtext what my main class is doing.
thnx for reading in advance.
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace Modales_window
{
public partial class Form1 : Form
{
Form2 mw2 = new Form2();
public Form1()
{
mw2.closingeventhandler += new Form2.ClosingEventHandler(mw2_closingeventhandler);
InitializeComponent();
}
void mw2_closingeventhandler()
{
}
private void button1_Click(object sender, EventArgs e)
{
if (!mw2.Created)
{
mw2.Show();
}
else
{
MessageBox.Show("already open", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
private void button2_Click(object sender, EventArgs e)
{
textBox1.Text = Application.OpenForms.Count.ToString();
}
}
http://www.codeproject.com/Messages/3043750/Re-two-forms.aspx[^]
Bad = knowing 2 much
|
|
|
|
|
You need to hook up to the closing event in form2, so that form1 knows when form2 is closed, and resets it to null. Then use a null check to create a new form. OR change the code in form2 so that it never gets closed, it just hides itself.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
wel, my goal was to keep the class going.
as a sort of debugging window and make a reapear when needed.
using the same button that created the original window.
i know there are other possibilites to do this.
by creating a simple class, store data, a array to hold the classes and create a new instance of Form2.
Form2 contains a RichTextBox so i can display things of interest to me.
i added a FormClosing Event + a Callback in Form2
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
namespace Modales_window
{
public partial class Form2 : Form
{
public delegate void ClosingEventHandler();
public event ClosingEventHandler closingeventhandler;
public Form2()
{
InitializeComponent();
}
protected virtual void OnClosingEventHandler()
{
if (closingeventhandler != null)
{
closingeventhandler();
}
}
private void ModalesWindow2_FormClosing(object sender, FormClosingEventArgs e)
{
OnClosingEventHandler();
}
}
}
but this solution doesn't prevent the 'Cannot access a disposed object' error mw2.Dispose();
public Form1()
{
mw2.closingeventhandler += new Form2.ClosingEventHandler(mw2_closingeventhandler);
InitializeComponent();
}
void mw2_closingeventhandler()
{
mw2.Dispose();
}
now i tried this, the same button creates/togles the visibillity of the window.
but once you close Form2 with the 'close' button of the form i return to 'Cannot access a disposed object' error
private void button1_Click(object sender, EventArgs e)
{
if (!mw2.Created)
{
mw2.Show();
}
else
{
if (mw2.Visible == true)
{
mw2.Visible = false;
}
else
{
mw2.Visible = true;
}
}
}
having come this far, i'm intrested in both.
1 - how to work around 'Cannot access a disposed object'
if you try to open the window again with the same button once you closed it with the RED X button of the form.
You need to hook up to the closing event in form2, so that form1 knows when form2 is closed, and resets it to null. Then use a null check to create a new form
2 - prevent the RED X button to close it and mw2.Visible = true
change the code in form2 so that it never gets closed, it just hides itself.
please show me what you have in mind.
thank you and kind regards
p.s. as a non native english speaker, i hoped to explained myself wel
p.p.s the most simple work around is to set the FormBorderStyle = none , but i like to learn
: )
Bad = knowing 2 much
|
|
|
|