|
Hi,
As per my understanding after every edit or add you must be binding your grid somewhere and i think you are not setting its current page index...
Hope it will work...
Thanks
~Anuj~
|
|
|
|
|
i have not used connection string.I've used .dat file as DB, READING AND WRITING DATAS IN TMP TABLE.If anyone has code sample it will be more helpful.Thanks in advance.
|
|
|
|
|
Hi,
I am creating a windows application,that contains a folder,with 5 files. how to programaticlly get the names of all the files in that folder(getting names of all the contents of that folder)
Say folder name is "MyXMLFolder" .It contains elemnts as
-Customer.xml
-Employee.Xml
-Bank.xml
I want c# coding to get all the names of the files in "MyXMLFolder" folder
-- modified at 2:13 Monday 13th August, 2007
|
|
|
|
|
DirectoryInfo dir = new DirectoryInfo(@"F:\MyFolder");<br />
FileInfo[] files = dir.GetFiles("*.*");<br />
<br />
Foreach(FileInfo f in files )<br />
{<br />
Console.WriteLine("Name is : {0}", f.Name);<br />
Console.WriteLine("Length of the file is : {0}", f.Length);<br />
Console.WriteLine("Creation time is : {0}", f.CreationTime);<br />
Console.WriteLine("Attributes of the file are : {0}",<br />
f.Attributes.ToString());<br />
}
Ref:
Working with Files in C#[^]
File Information using C#[^]
Hope it helps.
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you.
|
|
|
|
|
Thank you, for detailed description,
working
|
|
|
|
|
Hi,
You need to use the System.IO namespace. The following code will get you all files in a folder as strings in a string array, including the folder path:
string[] files = Directory.GetFiles(@"c:\MyXMLFolder");
Everything you will need to work with files can be found in System.IO.
Regards,
Toby
|
|
|
|
|
|
Hello Friends,
I had generated the crystal report.I want to change the connection string but I am unable to do so . Actually their are two database one is testing database and other is live database. So I need to change the connection string.
But I am unable to do so.
Regards,
rahul saini
|
|
|
|
|
Open your crystal report and on the left hand side you will find Field Explorer, under that you will find Database Fields, right click on that and click on Database Expert and the Database Expert Dialog box will open from there choose Project Data or Create New Connection, according to your need.
Thanks
Imran
|
|
|
|
|
Hello Imran,
If I choose new connection then all the feilds that i had drag from the previous table will delete.
Regards,
rahul saini
|
|
|
|
|
Ya the feilds will get deleted, do one thing what ever feilds you have dragged earlier, select all the feilds and copy it and when u create new report just paste all the feilds as it is, hope this may help.
Thanks
Imran
|
|
|
|
|
But Imran I had aroung 10 to 15 reports.
How is it possible to edit every time.
Is their any other sollution , through coding.
Regards,
rahul saini
|
|
|
|
|
I think u must have written some class where u have defined the connection string, change the connection string from there first, what ever new connection string you want. Now in report section u might be using Crystal Report Viewer, so in that Form Load write code like this, according to your table name and class name.
I hope this will help you.
private void CreateReport()
{
this.datcMarketData.getdatafrmdatabase();
JobMarketReport report = new JobMarketReport();
report.SetDataSource(datcMarketData.dSet);
crystalReportViewer1.ReportSource = report;
}
Thanks
Imran
|
|
|
|
|
Hi I am developing an windows application in C#.Net(2003).
My form has some textboxes, button and a datagrid. The functionality of the application is in a DLL.
The functionality is like this.
Enter input parameters in text boxes (one parameter belongs to time)
Click Start Button ==> the control goes to the DLL. based up on the time it has to perform the functionality.(suppose for example if we give 4 hours)
After completing a specific period (for example say 1hour) we have to enter a row in the data grid. THis action is done from the form.
For this i am using a timer in the form, on the elapsed time i am entering a row to the data grid by using a datatable.
Also notice one thing, I am using notify icon to show my application in system tray when it is minimized. If the addition of row is done when the form is in the minimized state, if i double click on the icon in the system tray then it is giving an exception "Object reference is not set" from the code in the notify icon Click. In this i am using a statement
this.ShowInTaskbar = true;
when the form is in normal state, adding a row to grid is happening correctly but the form is not responding after performing this action.
Any one please help me.
Thanks in Advance
Thanks and Regards
Ramu
|
|
|
|
|
Hi -
I try add a new row in DataGridView. But when I try to delete that it says "Uncommitted new row cannot be deleted". Does anyone know how to commit to add a new row? ANy help is appreciated.
Thanks
SHubho
|
|
|
|
|
shubhabratam wrote: I try add a new row in DataGridView. But when I try to delete that it says "Uncommitted new row cannot be deleted". Does anyone know how to commit to add a new row? ANy help is appreciated.
I think you may need to call Update() method or EndEdit() method of DataGridView..
For example ~
myDataGridView.EndEdit();
OR
myDataGridView.Update();
Hope it helps.
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you.
|
|
|
|
|
I think u need to update the table. try this code, it is with respect to text boxes, accordingly you can try with datagrid.
string update = "Update JobEvaluationPlanData set Plan_id='" +
TxtPlanId.Text + "' ,Com_Fact='"
+ this.TxtCompFact.Text + "' ,Com_Fact_Def='"
+ this.TxtCompFactDef.Text + "' ,CF='"
+ this.TxtFactor.Text + "' where Plan_id= '" + this.TxtPlanId.Text + "'";
if (
this.TxtPlanId.Text != "" &&
this.TxtCompFact.Text != "" &&
this.TxtCompFactDef.Text != "" &&
this.TxtFactor.Text != "")
{
OleDbCommand command = new OleDbCommand(update, datcJobEvaluationPlanData.con);
datcJobEvaluationPlanData.dAdapter4.UpdateCommand = command;
//do the update
datcJobEvaluationPlanData.dAdapter4.UpdateCommand.ExecuteNonQuery();
MessageBox.Show("Record Updated...");
RefreshData();
}
Thanks
Imran
|
|
|
|
|
I am using a DataGridView Control. I want to add a row which is just added to the Grid.
|
|
|
|
|
I have used this code to add data to the table with respect to Text Boxes, u can try this for Datagrid with some changes.
string strInsert;
strInsert = "insert into JobEvaluationPlanData" +
"(Plan_Id, Com_Fact, Com_Fact_Def, CF)"
+ "values('" + this.TxtPlanId.Text + "','"
+ this.TxtCompFact.Text + "','" + this.TxtCompFactDef.Text + "','"
+ this.TxtFactor.Text + "')";
if (
this.TxtPlanId.Text != "" &&
this.TxtCompFact.Text != "" &&
this.TxtCompFactDef.Text != "" &&
this.TxtFactor.Text != "")
{
OleDbCommand command = new OleDbCommand(strInsert, datcJobEvaluationPlanData.con);
datcJobEvaluationPlanData.dAdapter4.InsertCommand = command;
//Do the Insert
datcJobEvaluationPlanData.dAdapter4.InsertCommand.ExecuteNonQuery();
MessageBox.Show("New Record Added...");
RefreshData();
TxtPlanId.ReadOnly = true;
}
Thanks
Imran
|
|
|
|
|
Hello ,
I am having a problem in this issue,
I am trying to print a XPS document by passin job name and file path to
PrintQueue.AddJob(jobname,filename,false)
now job is getting queued and printed but the folder where the file is which i am printing is getting locked(i.e I am not able to delete the folder) even if i am deleting the file inside it.
Who am I?
Do you know me....
|
|
|
|
|
Hello,
There are one Editable Gridview in my winform. This GridView is binded with DataTable. After making some changes in GridView, I want to update the DataTable that is binded to GridView.
I have tried with Grid.Update() and DataTable.AcceptChanges();. but it doesn't work.
So, How to synchronize between GridView and DataTable? OR how can I update the DataTable from DataGrid?
Thanks in advance.
|
|
|
|
|
Hi All,
For example im having a string like this "0:30:1A:1E:55:2"
i want to convert this string to "00:30:1A:1E:55:02"
how can i do this.
right now im split the string using ':' and then find the length if its 1 then add 0 in front of it, it works fine for me....
but i think some simpler way must be there....
so plz guide me if am wrong
With Regards
Amjath
|
|
|
|
|
Amjath Rahman wrote: add 0 in front of it
String.PadLeft Method[^]
<br />
Dim str As String<br />
Dim pad As Char<br />
str = "forty-two"<br />
pad = "."c<br />
Console.WriteLine(str.PadLeft(15, pad)) ' Displays "......forty-two".<br />
Console.WriteLine(str.PadLeft(2, pad)) ' Displays "forty-two".
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you.
|
|
|
|
|
Hello,
VS 2005
i have created a small windows application. I am wondering how can i make this into a independent program that can run as a custom action in a setup program.
Is it enough go into the bin directory and use the exe that is in there, and add that to the setup as the custom action.
The windows application uses a picture, is it best to have the picture embedded?
Many thanks for any suggestions.
Steve
|
|
|
|
|
Why did your post get downvoted?
Here[^] is an article that contains a good example of how to use your own code for a custom action.
|
|
|
|