|
Please see also my answer in this thread on CodeProject: [^]
|
|
|
|
|
It's the same as when you read a file from your local drive.
Why would you think it would be any different?
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
Hi,
I have a C# application that generates an organization chart using the Microsoft Visio Org Chart Wizard. It works just fine but i was wondering if it were possible to place the items on the chart at a custom position. Right now, the items are placed starting at the top of the page and i'd like them to start a bit lower.
Thanks
|
|
|
|
|
hi, it is posible that you share your code????
=)
|
|
|
|
|
how i can remove this full tag
<item><br />
<tag1>OK</tag1><br />
<tag2>button OK</tag2><br />
<!-- button2 --><br />
</item>
in this resource file
<resources>
<item>
<tag1>OK</tag1>
<tag2>button OK</tag2>
<!-- button2 -->
</item>
<item>
<tag1>0,0</tag1>
<tag2>button OK</tag2>
</item>
<item>
<tag1>75,23</tag1>
<tag2>button OK</tag2>
</item>
</resources>
|
|
|
|
|
|
|
hi,
i have created a report using report viewer nw i want to make border of some cells double on the basis of a criteria.hw can i do this.
Regards
Ali
|
|
|
|
|
|
i created crystal report,in that i use database expert option and crate new connection take one table from database(SQL SERVER 2005) and drag and drop some field,finally report is run,this is done in integrated security=true,
when that project i run on other local machine,report ask for login,so i wnt change connection string,how it to done?
|
|
|
|
|
Look under Settings.Settings in the proprties. Usaly connection string is saved there if you used automatic generated code
|
|
|
|
|
How to get free Library for Math graph 3D?
|
|
|
|
|
This forum is related to C# and other programming language from Microsoft. Use google
|
|
|
|
|
hi i have made an application which reads outlook events. while reading outlook events a warning popup comes with message "A program is trying to access your mail information...... " this is annoying for my users of application. Is there any way i can bypass this message i have useed Microsoft.Office.Interop.Outlook dll to read events. and code is written in c# .Net.
plz help
Thanks
|
|
|
|
|
Your code cannot bypass this message. Outlook has to be told to trust the code. Look under Tools -> Macro -> Security.
|
|
|
|
|
but how come google calendar sync does that. Do they have some collaboration or something.
|
|
|
|
|
Because it's not using the Outlook object model.
There is also a library ($$$) that solves the problem, but it is not free.
|
|
|
|
|
hello,everyone:
i'm a beginner of C#,i use crystal report do report.
Now,in my project,i use Dategridview to show datebase,the serach Condition is two
DataTimerPicker.now,i just want the dates which is searched to report,but everytime when i do the report,it'll report all the dates in my datebase,but i just want report some of them,no all!i know Crystal Report can do this job very good,but i do not know how to make my code,so please everyone show me some method or give some others to teach me!Very appriate!
Student miss YY
modified on Wednesday, January 6, 2010 9:51 PM
|
|
|
|
|
hi,
you can try the following links,
http://www.codeproject.com/KB/cs/CreatingCrystalReports.aspx
http://csharp.net-informations.com/c...stepbystep.htm
There are examples of a step by step help for crystal reports in C#,
it may help you.
modified 27-May-14 5:04am.
|
|
|
|
|
thanks very much!
i can't login "
|
|
|
|
|
If I want to know what kind of encoding a certain file is already saved as, which method do I use?
I can't use following because by creating streamwriter constructor, it will save the file as UTF-8 encoding:
StreamWriter sw = new StreamWriter(@filepath);
so by providing a path to a file, not sure how I can detect which encoding the file has..
can anyone please help me?
|
|
|
|
|
Hi,
you could open the file for reading and get the first few bytes of the existing file; then check those for the special codes that are present in UTFx encoded files, something along these lines:
if (len>=3 && buffer[0]==0xEF && buffer[1]==0xBB && buffer[2]==0xBF) {
encoding=65001;
} else if (len>=2 && buffer[0]==0xFF && buffer[1]==0xFE) {
encoding=1200;
} else if (len>=2 && buffer[0]==0xFE && buffer[1]==0xFF) {
encoding=1201;
} else {
encoding=1252;
}
later on, you can create a StreamWriter that takes the encoding into account, by using one of the constructor overloads and an Encoding instance.
|
|
|
|
|
hi, the following code may help you.
System.Text.Encoding enc = null;
using (System.IO.FileStream file = new System.IO.FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.Read))
{
if (file.CanSeek) { byte[] bom = new byte[4]; // Get the byte-order mark, if there is one
file.Read(bom, 0, 4);
if(bom[0] == 0xef && bom[1] == 0xbb && bom[2] == 0xbf)
{
enc = System.Text.Encoding.UTF8;
}
else if (bom[0] == 0xff && bom[1] == 0xfe)
{
// ucs-2le, ucs-4le, and ucs-16le
enc=System.Text.Encoding.Unicode;
}
else if(bom[0] == 0xfe && bom[1] == 0xff)
{
// utf-16 and ucs-2
enc=System.Text.Encoding.BigEndianUnicode;
}
else if(bom[0] == 0 && bom[1] == 0 && bom[2] == 0xfe && bom[3] == 0xff)
{
// ucs-4
enc = System.Text.Encoding.UTF32;
}
else
{
enc = System.Text.Encoding.ASCII;
}
}
else
{
// The file cannot be randomly accessed, so you need to decide what to set the default to
// based on the data provided. If you're expecting data from a lot of older applications,
// default your encoding to Encoding.ASCII. If you're expecting data from a lot of newer
// applications, default your encoding to Encoding.Unicode. Also, since binary files are
// single byte-based, so you will want to use Encoding.ASCII, even though you'll probably
// never need to use the encoding then since the Encoding classes are really meant to get
// strings from the byte array that is the file.
enc = System.Text.Encoding.ASCII;
}
return enc;
}
best wishes.
modified 27-May-14 4:59am.
|
|
|
|
|
Thank you so much, Carle!
but there are so many other encodings such as GB18030-codepage 54936,, etc. if you look under 'Advanced Save options' in Visual Studio, you will see a bunch of different encodings.
with your case, it seems like that if the encoding doesn't fall under any of the UTF-x, you set the encoding as ASCII. but what if the encoding of the file is some other encoding?
Thanks!
|
|
|
|
|
Hello
I´m using an excellent tutorial:
http://www.codeproject.com/KB/grid/usingdatagrid.aspx
I'm not using MS Access, what is recommended in the tutorial, but MS SQL Comapact Edition as Data Provider. This shoult doesn't make a different.
But every time I try to execute the following code, an error message appear.
And the dataGrid is not displayed on the form.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlServerCe;
namespace DataGridViewTest
{
public partial class Form1 : Form
{
private System.Windows.Forms.DataGrid dataGrid1;
public Form1()
{
InitializeComponent();
this.dataGrid1 = new System.Windows.Forms.DataGrid();
this.dataGrid1.Location = new System.Drawing.Point(20, 20);
this.dataGrid1.Name = "dataGrid1";
this.dataGrid1.Size = new System.Drawing.Size(200, 100);
}
private void fnDisplayDataInDataGrid()
{
string conStr = "Data Source=C:\\CSharp\\DataGridViewTest\\DB_Personen.sdf";
SqlCeConnection conn = new SqlCeConnection(conStr);
conn.Open();
SqlCeDataAdapter adapter = new SqlCeDataAdapter("SELECT * FROM Adressen", conn);
DataSet ds = new DataSet();
adapter.Fill(ds, "Adresse");
this.dataGrid1.DataSource = ds.DefaultViewManager;
}
private void Form1_Load(object sender, EventArgs e)
{
fnDisplayDataInDataGrid();
}
}
}
The error message predicate I need a DLL. But wich DLL and where can I get it ?
A first chance exception of type 'System.DllNotFoundException' occurred in System.Data.SqlServerCe.dll
Can someone help me, please ?
Sincere regards
Samuel
|
|
|
|