|
Thanks I will take a look on it, it seems to me as very interesting library.
Best regards,
Fehim.
|
|
|
|
|
Hello,
I want to convert datagridview to excell.
I need to create a button that will do it.
Every time that i click on it , it will create a new worksheet (in a specified workboox- or a file).
Also i need it to autoresize the columns width (as in the datagrid) and change the background of the headercells to some color (doesn't matter which).
How can i do it?
|
|
|
|
|
You can try to do that with:
http://www.devexpress.com[^] components which are not free but they worth.
You can export datagrid in excel/pdf/html/xml ... with few lines of code.
In order that you want to use "native" datagridview, you can try to save underlaying dataset to excel using JET drivers or ODBC connection.
Here is how you can made connection:
public OleDbConnection Conn
{
get {
if (conn == null)
//conn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + filePath + ";Extended Properties=Excel 8.0;");
conn = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + filePath + ";Extended Properties=Excel 12.0;");
return conn;
}
}
Best regards,
Fehim.
|
|
|
|
|
I didn't understood so much what does it mean using the connection...where do i write the sql query etc. And i need it to autoresize the columns with and copy the header cells too (with background in the header row (cells).
|
|
|
|
|
on this way you can't resize columns , for that purpose you must use excel com objects. There is a lot of resources on internet. Did you look on this one: Simple Excel Automation using C#[^]
|
|
|
|
|
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
|
|
|
|