|
in event handler of the liust where you have listed the drive
write this code
DirectoryInfo dri = new DirectoryInfo(listBox1.SelectedItem.ToString());
GetAllDir(dri);
|
|
|
|
|
I am in need of some help. I have written the following code to save entries in a datagrid to the database, my code looks like this:
UseWaitCursor = true;
this.Validate();
this.accountTypeBindingSource.EndEdit();
ServiceReference1.Service1Client proxySaveBankAccountTypes = new WBGTS.Client.ServiceReference1.Service1Client();
var bankAccountTypeChanges = (WBGTS.BusinessLogicLayer.dsWBGTS)this.dsWBGTS.GetChanges();
if (bankAccountTypeChanges != null)
{
if (proxySaveBankAccountTypes.SaveAccountType(ref bankAccountTypeChanges))
{
var bankAccountTypeRows = from row in this.dsWBGTS.AccountType
where Convert.ToBoolean(DataRowState.Added)
select bankAccountTypeChanges;
this.dsWBGTS.Merge(bankAccountTypeChanges);
this.dsWBGTS.AcceptChanges();
}
}
UseWaitCursor = false;
The problem is that when I add somthing to the datagrid it always shows the -1 number and the new record, after closing the form and opening again the record is fine but if you add a new entry it shows duplicates again!
I am trying to build a foreach loop into this method but I am having difficulty converting dataset to datarow.
Thanks!
Illegal Operation
|
|
|
|
|
Illegal Operation wrote: but I am having difficulty converting dataset to datarow.
A dataset is a collection of datatables. A datatable has a collection of datarows.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
I have a simple batch file script here that runs during log on and log off that writes a rolling CSV file of each user and which computer they are on. Just for fun, here's what I am running...
LOG ON SCRIPT:
for /f "Tokens=2 Delims=[]" %%i in ('ping -n 1 "%computername%"') do set IP=%%i
rem The following line creates a rolling log file of usage by workstation
echo Log In: %TIME% %Date% %USERNAME% >>\\lsdnas3\Logs\Computers\%COMPUTERNAME%.log
rem The following line creates a rolling log file of usage by user
echo Log In: %TIME% %Date% %COMPUTERNAME% IP=%IP% >> \\lsdnas3\Logs\Users\%USERNAME%.log
LOG OFF SCRIPT:
for /f "Tokens=2 Delims=[]" %%i in ('ping -n 1 "%computername%"') do set IP=%%i
@rem The fololowing line creates a rolling log file of usage by workstation
@echo Log Off: %TIME% %Date% %USERNAME% >> \\SERVER\Logs\Computers\%COMPUTERNAME%.log
@rem The following line creates a rolling log file of usage by user
@echo Log Off: %TIME% %Date% %COMPUTERNAME% IP=%IP% >> \\SERVER\Logs\Users\%USERNAME%.log
Well, I want to first choose computer or user logs... Got that figured out (duh) but how do I get a dropdown that will list each file so I can open it as a data source and display it? I know how to open and read the files, and all that boring stuff.
I am sure I will figure it out via a bit of research, but I thought asking might help someone else looking for a similar solution in the future.
Matt
|
|
|
|
|
This won't compile, it's not valid C# code.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Oh I understand... This is a simple batch file for DOS (runs in Windows XP in our domain).
I write a lot of simple asp.net apps so I can use them anywhere in any of our locations... These log files were fabricated because we have a lot of users who bounce around from PC to PC and we want to be able to know where they are when they call or e-mail us.
I am writing an ASP.NET intranet site with C# and want to use C# to display what these batch files created. (I posted them above because I know batch files can be fun).
I thought it would be relevant since it is using a different method (other than C#) to start the process of logging.
|
|
|
|
|
For some reason I was expecting a story about cows.
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
KnotBeer wrote: Well, I want to first choose computer or user logs... Got that figured out (duh) but how do I get a dropdown that will list each file so I can open it as a data source and display it? I know how to open and read the files, and all that boring stuff.
To get a list of files, you can use the [Directory.GetFiles^]. I believe this will work with UNC paths as well as local paths. To read the file as a data source you can look at [this^] article.
Hope that helps.
Tanks for your support
Pat O
<a href="http://currentchaos.blogspot.com/">Blog</a>
_ _ _
|
|
|
|
|
I've started using LINQ to get data out of my SQL DB and it workes fine. I load the data and use databinding to get the data in the grid. The code lools like that:
BudgetDataDataContext _budgetDataContext = new BudgetDataDataContext();
bindingSourceNsc.DataSource = from n in _budgetDataContext.Nscs select n;
gridControlTest.DataSource = this.bindingSourceNsc;
The data is shown in the grid. That's fine. Now the user can change values directly in the grid. I'M chatching the event when the change has been made and want to write the new data to the database (update). The code therefore looks like that:
_budgetDataContext.SubmitChanges(System.Data.Linq.ConflictMode.FailOnFirstConflict);
The problem now is, that the data in the database is not changed. Can anyone give me a hint what I've done wrong?
BR
Honk
|
|
|
|
|
I'd no expert in Linq-to-SQL, but I'd guess the problem is this:
bindingSourceNsc.DataSource = from n in _budgetDataContext.Nscs select n;
You're essentially saying, "The data source is the result of this query". Since query results are read-only, your changes are getting back into the database.
Have you tried simply:
bindingSourceNsc.DataSource = _budgetDataContext.Nscs;
|
|
|
|
|
hi everybody ,
can anyone tell me what reference should i add to use System.Threading.Tasks ?
Thank you !
|
|
|
|
|
Are you using VS2010 and .NET 4.0?? If not, it doesn't exist in previous version. Considering neither 2010 or .NET 4.0 is out yet, it's unlikely you're using it.
|
|
|
|
|
oh , i see
I had found a tutorial that was mentioning it , and i though it was already there .
Thank you !
|
|
|
|
|
I thought it was also in ParallelFX? I'm not too sure though..
|
|
|
|
|
Probably, but it's more rare to come by in the forums.
|
|
|
|
|
Hi,
I wanted to know if there is any way to call a method from just clicking a radio button without having to click on an apply button.
Thank you
|
|
|
|
|
The Click event may help you here. If you want something more efficient, which isn't called unless the checked value changes, use CheckedChanged or something like that
|
|
|
|
|
Thank you, But I managed to figure it out by myself makes me pround
|
|
|
|
|
Is it possible to open and play mpeg file using aforge.net.
I get an error with the code
FileVideoSourcer vs = new FileVideoSource(Filename);
vs.NewFrame += new NewFrameEvntHander(Video_Frame);
vs.start();
void video_Frame(obj--------)
{
Bitmap bit = events.Frame;
}
Can anyone help me please::
Thank you
|
|
|
|
|
Why don't you ask people who know what aforge,net is ?
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Hello,
I have developed one application, and added it to right click pop-up menu of the folder.
Whenever user right-clicks on folder and selects my application from pop-up menu, I want the path to that folder (on which user has done right click).
I am using Directory.GetCurrentDirectory(), but it gives me path to the parent directory of the user right clicked directory.
How can I get the path to the directory on which user has done right click?
Regards
Abhishek
|
|
|
|
|
Perhaps you could pass the folder name to the application. Presumably, you've added a registry entry in order to allow you to run something from Windows' context menu. Append %1 to the end of the program's registry entry and parse the folder name as a command argument
|
|
|
|
|
Make that "%1" (with the double quotes) so the path is allowed to contain spaces...
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
modified on Sunday, June 12, 2011 8:32 AM
|
|
|
|
|
Thank you very much...
It solved the problem.
Thanks again
Regards
Abhishek
|
|
|
|
|