|
Response.Clear();
Response.AddHeader("content-disposition", "attachment;filename=FileName.xls");
Response.Charset = "";
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.ContentType = "application/vnd.xls";
System.IO.StringWriter stringWrite = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);
myDataGrid.RenderControl(htmlWrite);
Response.Write(stringWrite.ToString());
Response.End();
I know nothing , I know nothing ...
|
|
|
|
|
|
Take a look at Single Instance Application in C#[^].
There are several other articles about this on the web, I found the one above and loads more by googling single instance c#.
Give it a go yourself if the one given is not good for you.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
To add to Henrys' comment: Don't post your email address, unless you really like spam!
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
Well spotted. I didn't notice that amongst all the beautifully formatted text.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
i thought i didnt post my email.................where did u saw it....so zat i can remove it.............tnx 4 z help
|
|
|
|
|
In your original post:
matiIsGreat wrote: please ppls help me with this problem.............I made a program with C# and prepare a set up to be installed to the user computer...........but after u install it u can open many instances of the program @ one time............so how can i make it to be opened only 1 @ a time......if i didnt make that my buyer is not going to buy me.......so plz help me(my email is getXXXX@XXXXXXil.fm )...thank you all
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
tnx dude..........i didnt thought of zat......i didnt know hw my eyes worked...loll
|
|
|
|
|
To ensure a single instance of an application, you can try something like the following:
bool createdNew = true;
using (Mutex mutex = new Mutex(true, "MyApplicationName", out createdNew))
{
if (createdNew)
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MainForm());
}
}
Place the following code in the main entry point for your application. With VS 2005, you would place this in the Program.cs.
|
|
|
|
|
|
Easy peasy:
If your form load event:
Process process = Process.GetCurrentProcess();
Process[] processes = Process.GetProcessesByName(process.ProcessName);
if (processes.Length != 1)
{
Close();
}
If you had Googled it, you would have found a class to do it on this very forum...
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
This technique works, but copying the .EXE to another filename will defeat this solution. Granted, it's not going to be very common "work around" to get a second or third copy running, but, I think there are better methods to solving the problem than this that are more secure.
|
|
|
|
|
on a single PC? or on different machines?
Luc Pattyn [Forum Guidelines] [My Articles]
DISCLAIMER: this message may have been modified by others; it may no longer reflect what I intended, and may contain bad advice; use at your own risk and with extreme care.
|
|
|
|
|
for now i just wanted only 4 one pc...........it would also b better if u told me on a different machine....tnx dude
|
|
|
|
|
eye nodding understanded
Luc Pattyn [Forum Guidelines] [My Articles]
DISCLAIMER: this message may have been modified by others; it may no longer reflect what I intended, and may contain bad advice; use at your own risk and with extreme care.
|
|
|
|
|
I have a requirement to connect a network drive, once it gets disconnected.
I am using WNetAddConnection2A() API of mpr.dll. It works fine for a console/windows application.
When I tried to use the same code in windows service, it’s unable to connect the drive.
WNetAddConnection2A() returns an int value. A non zero value is a failure and zero is a success.
In windows service it returns zero, still drive does not get mapped/connected.
int result = WNetAddConnection2A(n, password, username, dwFlags);
In ServiceProcessInstaller we have 4 types of Account. I tried with all of them and got the below return value from WNetAddConnection2A().
1- LocalService : 1312
2- NetworkService : 0 (Success, Still drive is not mapped).
3- LocalSystem : 1312
4- User : 0 (Success, Still drive is not mapped).
Error 1312: A specified logon session does not exist. It may already have been terminated.
Any help in this regard is appreciated. Also would like to know what kind of Account should I use.
Praveen Raghuvanshi
Software Engineer,
India.
|
|
|
|
|
What login account is your service running under?? If it's the LocalSystem account, mapping a drive won't work since LocalSystem doesn't have permissions to any network resources. Your code has to supply a username and password to map the drive as someone else to map a drive. Even then, there may be a problem with the resource already being used by that account, in which case, the map will fail.
Without knowing what account the service is running under and what the code looks like that maps the drive, along with any values it's passing to the function, it's pretty difficult to say what's going wrong.
|
|
|
|
|
Hello,
i want to create an mobile application that send command or signal via bluetooth in order to open/close a door.
This applicatin should run for all kind of device and special for nokia market.
Any ideas how to start ??
best regards.
dghdfghdfghdfghdgh
|
|
|
|
|
Google is your friend.
There are loads and loads of hits for bluetooth c#.
I was not aware that there were bluetooth enabled doors, do they do windows too?
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
when i achieve my device may i will buy u the bad version, but tc, it should be so expensive.
dghdfghdfghdfghdgh
|
|
|
|
|
ellllllllie wrote: signal via bluetooth in order to open/close a door
Bluetooth enabled doors!
Nokia phones are Symbian OS based phones and AFAIK there is no in-built support for that in .Net. You will need to look into the redFIVELabs[^] product which enables you to run .Net applications on Symbian.
जय हिंद
|
|
|
|
|
I want the PDF file's data when it a PDF is opened in IE.
How can I do this using c#.
The COM reference AcroIEHelper.dll is added in my project.
ACROIEHELPERLib.AcroIEHlprObjClass acroIEHlpr = new ACROIEHELPERLib.AcroIEHlprObjClass();
acroIEHlpr is an Object element. From this how can I retrieve the information of PDF opened in IE.
How can I get the text of that PDF file?
|
|
|
|
|
Hi
i have a class called testparams:
[Serializable()]
public class TestParams {
public TestParams() {
}
private string m_filename;
[EditorAttribute(typeof(FileNameEditor), typeof(UITypeEditor))]
public string FileName {
get { return m_filename; }
set { m_filename = value; }
}
}
i use propertygrid and select the object :
TestParams TP = new TestParams();
propertygrid.SelectedObject = TP;
serialization :
private void Save(TestParams obj) {
XmlSerializer xs = new XmlSerializer(typeof(TestParams));
using (FileStream fs = new FileStream(Directory.GetCurrentDirectory() + "\\testparams.xml", FileMode.OpenOrCreate)) {
xs.Serialize(fs, obj);
}
}
}
The problem:
if the user selects the file with the "..." button and i try to serialize TP to xml nothing get written in the file !
when user writes his text freely the xml file is written correctly .
any help will be appreciated
shay
modified on Sunday, June 14, 2009 6:28 AM
|
|
|
|
|
Your use of GetCurrentDirectory is ill-advised. Since the CurrentDirectory can change at any time, without you knowing it, I recommend against using it unless you have a deep understanding of how the current directory is maintained from a system and application points of view.
Member 4086596 wrote: if the user selects the file with the "..." button
Of what control?? Are you showing a SaveFile dialog or what?? Use whatever full path this dialog returns, not CurrentDirectory.
|
|
|
|
|
it seems to me that BitVector32 only supports signed integer
and does not support un-signed integer, what is the reason?
thanks
|
|
|
|