|
I want to show a file under the SubFolder, (*.SFT)
MainFolder(is what am selecting)---> SubFolders--> (*.SFT) files
for e.g. 10 subfolder = 10 (*.SFT) files in it, to be listed in the DataGrid.
i use the below code to get the FolderPath.
string FldrPath = "";
// Create a new instance of FolderBrowserDialog.
FolderBrowserDialog folderBrowserDialog1 = new FolderBrowserDialog();
if (folderBrowserDialog1.ShowDialog() == DialogResult.OK)
{
FldrPath = folderBrowserDialog1.SelectedPath;
}
MessageBox.Show(FldrPath);
Cheers,
|
|
|
|
|
Below is some simple code that will get you started. This isn't the most flexible code that you can use but it should allow you to get started on the problem.
Personally I would build up a collection (Array, List or DataTable) and assign that as a data source.
Also it will only show the folders in the directory which you have specified and not each folders sub directory's.
DataGridViewTextBoxColumn first = new DataGridViewTextBoxColumn();
first.Name = "Name";
first.HeaderText = "Name";
dataGridView1.Columns.Add(first);
DataGridViewTextBoxColumn second = new DataGridViewTextBoxColumn();
second.Name = "FullName";
second.HeaderText = "Full Path";
dataGridView1.Columns.Add(second);
DirectoryInfo dir = new DirectoryInfo(@"d:\documents");
foreach (DirectoryInfo subDir in dir.GetDirectories())
{
dataGridView1.Rows.Add(new string[] { subDir.Name, subDir.FullName });
}
Every day, thousands of innocent plants are killed by vegetarians.
Help end the violence EAT BACON
|
|
|
|
|
According to the expert across the aisle, I can download and install a free version of C# from Microsoft's website.
I just looked, can't find it.
My friendly expert says that the one I want is Visual C# 2010.
Can someone point me to the right place ?
|
|
|
|
|
You're talking about the Express editions. If you want Visual C# Express 2010 you can find it here[^]. There are more up to date versions available (2012 and 2013).
|
|
|
|
|
Pete to the rescue ! Hooray, nice to know somebody who knows something.
I see the two other versions you mentioned also have "Express Editions" as well.
Can I install all three ?
|
|
|
|
|
They do, but I wouldn't advise trying to install all three. Basically, 2012 introduced .NET 4.5 which you could think of as a patch to .NET 4 (it introduced some new features and fixed some bugs in the .NET 4 assemblies), so while you could develop .NET 4 applications with it, they might not behave on a machine that just has .NET 4 installed on it.
Of course, if you want the features introduced in 4.5, then you need to go for 2012 as a minimum, but if you're doing that you are better off going straight to 2013.
|
|
|
|
|
Here's what's going on.
We have a small box that does magic.
We have an existing minimalist interface that sends commands to it, and tells us what it gets back.
Friday, I learned that we have access to the source code, and I can write my own stuff, and make the thing really smart; i.e.,
If I send X,then wait for him to respond with Y
If he responds with Z instead, then go do Blah, Blah, Blah
Anyway, that kind of smarts.
Should I stick with 2010, or go for the new kid on the block ?
|
|
|
|
|
If it were my project, I would stick with 2010 based on the fact that what you have currently works with this and you don't want to introduce any issues.
|
|
|
|
|
|
|
I didnt ask about the meaning of life, but I guess its not C#?
|
|
|
|
|
You had the answer, because you knew the right question to ask.
I asked the question, but I asked the wrong question.
Or, more probably, asked the right question in the wrong manner.
|
|
|
|
|
If you're into free IDEs then SharpDevelop (clicky[^]) is worth a look, it will read VS project files and it's pretty full featured.
|
|
|
|
|
Thanks, will examine it.
This is an interface to an external box on my desk.
We have a useful interface already. We send a command and the box responds; and we see the response on our screen; exactly as the spec told the guy to do a year or two ago; and he did his job quite well.
We now want to add our own smarts into this arrangement, and write an interface that lets us give the box a command, and then read the response; and make a decision on what to do as a result.
e.g., something like...
SendTheCommand("X Y Z")
Response = ReadTheResponse()
if (Response == 1)
{
DoTheFirstThing()
}
if (Response == 2)
{
DoTheSecondThing()
}
I think this is going to have to be C# by fiat more than logistics.
Anyway, I will certainly spend a few minutes looking at your open source suggestion.
|
|
|
|
|
I may not have been clear there, #Dev is an IDE for writing .Net (i.e. C#) programs.
|
|
|
|
|
How does it compare with VS Express?
|
|
|
|
|
I've never actually used VS Express because the only time I tried (back in the day) it wouldn't run on my low spec machine at the time. At work my employer pays for VS Pro. However I think a lot of the more useful features of VS (unit test execution, object model inspection, following references into libraries, probably the refactoring stuff) isn't in Express. And #Dev is still far kinder on memory and resources so it will generally run significantly faster.
|
|
|
|
|
|
Hi all
I have been searching and have found very little on this subject.
I am trying to connect simply to a webservice, call a method and get a response.
The service requires a nonce for authentication, but i can not ofr the life of me figure out how to generate one and pass it correctly.
I am call the webservice from a c# script using webClient.
I can add basic network credentials, of username and password.
But how do i add the full header correctly with a generated nonce.
The authentication part of the header looks like this.
<pre lang="xml"> <SOAP-ENV:Header>
<wsse:Security mustUnderstand="true">
<wsse:UsernameToken>
<wsse:Username>admin</wsse:Username>
<wsse:Password
Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">bG4Gz8elJibVIABSaX5nB7uTSBM=</wsse:Password>
<wsse:Nonce
EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">+MnwDfmScWNR2j5MBV+Ikg==</wsse:Nonce>
<wsu:Created>2014-03-06T12:37:36.174525Z</wsu:Created>
</wsse:UsernameToken>
</wsse:Security>
</SOAP-ENV:Header>
</pre>
I am new to using webservices so for give my ignorance.
|
|
|
|
|
If you're using WCF, I would advise reading the answers detailed here[^].
|
|
|
|
|
Hi fellow members
I'm working on a personal C# project , in which i estimate the budget - assets , account receivables , debts ... etc. The main requirement is that the code should not interact with a server side database , instead it can interact with a client MS access database.
It has a snowflake schema . Need your help in understanding how we can setup a MS access database and use it in C# code.
If any such code is available ,please send the link.
Appreciate your help
Thanks
Praneeth
Bob.
|
|
|
|
|
bobba praneeth wrote: If any such code is available ,please send the link.
You really just need to google "c# ms access database tutorial", this returns in excess of 23,000,000 results. At least one of these is going to get you started.
Unless you are tied to Access for some reason, you could swap to SQL express, this will allow you to use Entity Framework which takes a lot of the effort out of pushing information in/out of objects.
|
|
|
|
|
Here is an article I wrote on database connection[^], but if you can help it avoid Access databases. They are a pain in the ass. Both Oracle and SQL-Server have free versions out there and MySQL and PostgreSQL are also very good alternatives (both free as well)
If you're developing pure .Net I'd go for SQL-Server Express.
PS: My article is one way of doing things, there are other ways as well.
hope this helps.
|
|
|
|
|
The wording 'set up an Access database' implies you don't have it yet and therefore have a free choice of tech. In which case: don't use access. Even a System.Data.DataSet serialised to disk is probably better than that. Really you should set yourself up a proper ODBC data source (e.g. SQL Server, mySQL etc) and use System.Data to interact with it.
|
|
|
|
|
Just to back up what the others say: if you are using this for multi-user at all - i.e. if at any time there will be more than one user using the database in any way, then Access is a poor solution, and will give you nasty problems. You do need to use a "proper" multiuser system, and that means SQL Server or MySql.
If you only ever need it for a single user, then Access will work, but I'd still be tempted to use SQLCE or SQLite instead - and I have Access on my system!
If you must use Access, then you need to install the appropriate ACE driver: 32 bit or 64 bit (you can't install them both on the same machine), and use OleDbConnection and OleDBCommand objects to access them: Google can help with that.
Those who fail to learn history are doomed to repeat it. --- George Santayana (December 16, 1863 – September 26, 1952)
Those who fail to clear history are doomed to explain it. --- OriginalGriff (February 24, 1959 – ∞)
|
|
|
|