|
yes obviously....
That is the reason why i keep on scratching my head.......
Have a Happy Coding.....
|
|
|
|
|
You could use a mechanism where you sign the xml with a certificate (private key). Within your dll you can check the signature of the xml (public key), to check that the xml was modified by you. This will let you take the advantages of xml when a user upgrades (better than using a dll that you have to compile).
Regards
Sebastian
|
|
|
|
|
Thank you sebastian!
Oh!! That really thrown some light!!!
Thanks again...
Have a Happy Coding.....
|
|
|
|
|
what is the use of get set properties in C #
|
|
|
|
|
Properties are a better way of controlling your private member variables.
get and set accessors are used to facilitate this access control.
assume you have a private member
private int count;
Now you want to assign some value to the variable and need to read it whenever required.
You can safely reveal your count variable to external world using a property declaration like this:
public int Counter
{
get
{
return count;
}
set
{
count = value;
}
}
"There are a few reasons to use properties, instead of public fields. One is that properties can be virtual. Another is that you can make the setters for a property private. Another is that properties have a 'special' meaning to things that inspect classes at runtime. There are frameworks for conveniently talking to databases and for reading and writing objects to and from XML and all sorts of other things -- and they automatically look at the object's properties (and not private fields or other things) to see how to do their job."
For better clarification i would suggest you to buy a C# book and spend some time in learning the basics..... rather than asking the same in the forums.....
Have a Happy Coding.....
|
|
|
|
|
To add to this most excellent reply, they also aid with encapsulation. Because you expose a method rather than a field with get, set, the implementing class can replace the internal implementation of the property without affecting the outside world. If your class keeps a hard count of elements in a tree (say) and exposes that via "public int count" then it must retain that count for all time. If it is exposed via
public int Count
{
get { return count; }
set {count = value; }
}
then it is at liberty to dispose of the "count" field and replace it with a new implementation at will. This will not affect classes relying on the "Count".
Further, it allow you to error check the assignments:
public int Count
{
get { return count; }
set
{
if ((value < 100) && (count >= 0))
{
count = value;
}
else
{
throw new Exception(string.Format("Value out of range: {0}", value));
}
}
}
But I agree - read a book, because if you don't know this stuff, there are a lot of other complexities you need to be aware of before you go much further!
Good luck.
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
|
|
|
|
|
|
HOw i Display CSV File Data TO DataGridView
Please Help me With Connection string And Code.
|
|
|
|
|
Hi!!!
Try to do some research by yourself instead of asking code from others....
have a look at this site....
csv to datatable[^]
Can give you some insight regarding the issue....
Have a Happy Coding.....
|
|
|
|
|
I have tried it But i got Error Path is not correct even i give it to right path
here is my code
string Con_Str = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\My\a.csv;Extended Properties=Text;HDR=No;FMT=Delimited";
OleDbConnection cn = new OleDbConnection(Con_Str);
cmd=new OleDbCommand("select * from Book1.CSV",cn );
da=new OleDbDataAdapter(cmd);
ds=new DataSet();
da.Fill(ds,"ex");
dataGridView1.DataSource=ds.Tables[0].DefaultView;
|
|
|
|
|
So what's the filename of your CSV file?? In your code you have, in the connection string, C:\My\a.csv. But, in the OleDbCommand, you have Book1.CSV. So, which is it??
|
|
|
|
|
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Reflection;
using System.Runtime.InteropServices;
using Excel = Microsoft.Office.Interop.Excel;
using System.Data.OleDb;
using System.Security.Cryptography;
public DataSet ExcelToDS(string Path)
{
//return one dataset
object missing = Missing.Value;
Excel.Application excelApp = new Excel.Application();
excelApp.Visible = false;
try
{
excelApp.Workbooks.Open(path, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing);
excelApp.Workbooks[1].Worksheets[i + 1];
Excel.Worksheet ws = (Excel.Worksheet)excelApp.Workbooks[1].Worksheets[1];
string sheetName = ws.Name;
string strConn = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=" + Path + ";" + "Extended Properties=Excel 8.0;";
OleDbConnection conn = new OleDbConnection(strConn);
conn.Open();
string strExcel = "";
OleDbDataAdapter myCommand = null;
DataSet ds = null;
strExcel = "select * from [" + sheetName + "$]";
myCommand = new OleDbDataAdapter(strExcel, strConn);
ds = new DataSet();
myCommand.Fill(ds);
conn.Close();
excelApp.Workbooks.Close();
excelApp.Quit();
excelApp = null;
return ds;
}
catch
{
MessageBox.Show("Not close EXCEL", "Err Info", MessageBoxButtons.OKCancel, MessageBoxIcon.Error);
KillProcess("EXCEL");
return null;
}
}
modified on Tuesday, May 5, 2009 3:52 AM
|
|
|
|
|
Hi ,
I am developing an application with a datagrid using which user can update the data in the datagrid row. Its all in ASP.Net c#.
on click of a button i should do the following.
Check if user has modified atleast one row.
1. If the user has not modified even one row, then i should display a messsage stating user to action atleast one row.--- I have done this check and works good.
2. If the user has changed atleast one row then i should display a alert asking for confirmation if they would like to proceed. If the user selects 'No' i should stop the execution. if he clicks Yes the execution should proceed. -- I need help on this .. I am not able to trigger it becuase the button is already clicked.
Please help me sort the point 2.
|
|
|
|
|
WE have an ASP.NET forum
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
if the useer click no whit action must be stopped?
modified on Tuesday, May 5, 2009 3:29 AM
|
|
|
|
|
On the click of yes the changes done by the user in datagrid is updated in databases. This should not happen if he clicks no.
|
|
|
|
|
if(MessegeBOx.Show("Are you sure?",...,MessageBoxBottunYesNo) == DialogResult.YES)
update();
else
return;
modified on Tuesday, May 5, 2009 3:28 AM
|
|
|
|
|
You'll using right to limit the buttom, and user right from userlevel list table.
|
|
|
|
|
Hi.
I have a question. Say you have a database with 10 tables, they all are related to each other. Now you start your Windows application and obviously you implement a typed dataset to enable offline work etc.
My question is this, is it better to create a few datasets or just one? Can I create a dataset for each table in the database?
Illegal Operation
|
|
|
|
|
Illegal Operation wrote: Can I create a dataset for each table in the database?
A DataSet can contain many tables, so creating separate dataset for each tables is not required.
|
|
|
|
|
DataSet has DataTableCollection, DataRelationCollection and ExtendedProperties using which you can store multiple tables inside a dataset. So there is no need use multiple datasets.
Either you love IT or leave IT...
|
|
|
|
|
I had small application of BHO in c#, when the events gets fired I used perform the operation that I
want to do on browser(IE). The thing is I want to know the header information? as the data gets loaded
on browser packet by packet, how can I know these header information regarding content length,
content-type that the data gets loadad on IE.
Thus how can I know header information through BHO?
|
|
|
|
|
Hi,
I am having some trouble debugging a windows service. i have attached a debugger to the service but after each change, do i have to rebuild my windows service, rebuild setup and uninstall and install the service. There must be an easy approach to this.
Please provide help
|
|
|
|
|
Solution explorer -> Right click on project -> Debug -> Choose any option
|
|
|
|
|
I have a datagridView in a winform and i display the results of a particular search. How do I highlight/bold only the charecters or the substring in the cell that matches my search.
(the best analogy would be the google finance, in which as you type ahead it bolds the characters that match the search)
thanks.
|
|
|
|