|
Well, there's all sorts of ways to do this. Why would you store your data that way ? What code have you written to read your files ? What point are you stuck on ?
Really, I think your program has overall design issues that would not be solved, even if it was clear what point you're stuck with here. Any sort of loop that turns numbers into letters is nastiness, so I wouldn't use a loop to generate filenames to start with.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
First excuse me for my bad english writing.
I am new in c# and i know there are better ways to sort but my teacher wanted me to store data this way.
I want to read all files for searching.
|
|
|
|
|
OK, if it's for a class, then it's fine that you do things badly, because your teacher is structuring things for you to learn particular things, instead of for the writing of good code. However, do you have code to read and write these files ? Is the only problem stepping through the different filenames ? I'd actually go with the suggestion of just reading all the txt files in the folder, rather than trying to write a loop, because any loop that generates the filenames by iteration, is going to be nasty code.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Use IO.DirectoryInfo to identify the folder
Foreach(FileInfo fileInfo in DirctoryInfo.GetFiles("*.txt")
{
.............
}
Or as you already know the file names you could use a loop on the ASCII/Char values, construct the file name and then use IO.fileInfo to get each file.
|
|
|
|
|
Mycroft Holmes wrote: Or as you already know the file names you could use a loop on the ASCII/Char values, construct the file name and then use IO.fileInfo to get each file.
Yeah, but that really is nasty as all hell. Why would someone store their data in 26 flat files to start with ?
Mycroft Holmes wrote: Foreach(FileInfo fileInfo in DirctoryInfo.GetFiles("*.txt")
Yeah, that's a good point, although I don't know if they would come sorted, this would work otherwise, so long as other txt files were not present
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
IIRC this guy is doing a contact system on a mobile device and does not have the know how to use a database, therefore the text files.
Personally I think the guy is nuts to do it this way but it may be (had better be) a learning project. If it is the same guy someone attempted to recommend options before and they have been ignored.
|
|
|
|
|
Mycroft Holmes wrote: Personally I think the guy is nuts to do it this way but it may be (had better be) a learning project
I am willing to bet that, like the moron I just answered in the ASP.NET forum, this clown is being paid for his messy code.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Christian Graus wrote: answered in the ASP.NET forum
I am forever thankful that I have limited ASP knowledge and almost no interest in the platform.
Christian Graus wrote: this clown is being paid for his messy code
I'm gonna be generous and assume he's in a learning phase. I once had 3 contracts in a row in the 90's following a guy who supplied crappy solutions, he was most lucrative for me, I did feel sorry for the clients though.
[edit] looks like someone did not like your negative response .[\edit]
|
|
|
|
|
Thanks for your attention and good help.
good luck.
|
|
|
|
|
Hi.
There is a HTML file beside of my EXE file, I wanna print it !
Could you please guide me how I can print it ?
Thanks
|
|
|
|
|
What are you asking exactly ? You can use the print verb for process.start to try to print your file, I guess.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Christian Graus wrote: What are you asking exactly ?
I'm gonna print an external HTML file via a C# Application.
Could you guide me ?
|
|
|
|
|
hi friends
i have done print job monitor using c# i am able to get all the details except the number of copies the user send for the print job. how can i get?. is there any way to get using any API could u plz help me
thanks u
Nishar A.
|
|
|
|
|
|
hi Developers..
I have a Form that contains a DataGridView and a Button and I want to bind this DataGridView to a Custom data source (BindingList) and I want to add a new Item to the DataGridView only when I Click the Button (( so dataGridView.AllowUserToAddRows = false )) , But the problem is that if I Click a Button to add a new row (item ) to the DataGridView , But then I decided to Cancel adding a new Item by pressing ESC the new row will not deleted
so what the solution
Thanks in advance
modified on Sunday, September 6, 2009 11:04 PM
|
|
|
|
|
a few points.
alladeen wrote: Double Click the Button
Single click on a button is the standard - I recommend you not change this.
You are running up against the most common problem with editing a list control, management is a nightmare. I recommend that you pop a dialog form you do the AED functions. I do the following
I have a menu strip with AED buttons.
Add passes 0 as the ID to a dialgo specifically build to manage the table/entity you want to work with.
Edit passes the currently selected rows ID value to the same form
Delete asks the used to confirm delete.
The dialog form allows you to have very fine control on the users input and writes the data back to the database, return dialogresult OK or Cancel to the parent form.
If the result was Ok/Delete (from the delete method) then the form reloads the DGV from the database. This entails some redundant calls to the database but MY DATA ALWAYS REFLECTS THE DATABASE information.
|
|
|
|
|
thanks Mycroft Holmes
that is an error when I wrote double click I meant click .
I want to bind the DataGridView to a custom data source ((BindingList )) not to a DataBase ,so what the solution
|
|
|
|
|
The strategy remains the same, pop a dialog, control the data manipulation in the dialog, make the changes to the source of the bindinglist, have the parent form reload the bindinglist after the dialog/delete makes a change. BindingList is just another data container.
|
|
|
|
|
hi
what's AED buttons .
and please explaine more .
My goal is to delete a newly row added , when pressing ESC .like a DataGridView when the property AllowUserToAddRows is set to True and ,I Add items to the DGV manually, so if focous on the last row and press ESC the row will be deleted but If the focous on another row the row will not deleted
.But the difference is that I want to add items to DGV not manually but programmatically
thanks
|
|
|
|
|
AED = Add Edit Delete
I think your goal is wrong, I think your entire strategy for handling AED is wrong. I do not allow editing in a list control and gave you the strategy I use to avoid that.
|
|
|
|
|
Hi, I'm wondering how to compile entire solution in one exe without any other dll files. There are a few possibilities:
1. Copy all files from dll projects into exe project (yah).
2. Compile all normally with dlls and use ILMerge (doesn't support NET frameworks higher than 2.0) or some shareware software to make it one exe (also you can use Thinstall) quite expensive...
3. Use resources, but managing is very annoying.
but... Is there any possibility to add an external existing dll project (my project) and compile it with other windows forms application (exe) and get only one exe file without dll files? Copying files from dll project is not desirable, because I want to have a possibility to modify dll and get those files synchronized...
Any suggestions?
|
|
|
|
|
No, if you want the code from the dlls, you need to copy it into your project.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Actually we create multiple projects and compile as dlls because if we need to change in any Business Logic we dont have to modify the presentation layer or any other layer.
If you want everything inside a single exe, then why do you need to create project. You can easily manage source using Hierarchy of folders, each of which will belong to a namespace.
I dont find any reason why you have to create a new project only to manage source codes....
AFAIK, only ILMerge is the process that can merge 2 dlls into single one. You cant have one exe output when you have more than one project using Visual Studio.
|
|
|
|
|
I think he may be having an issue with 3rd party DLLs, I know of no way to include these in an exe.
|
|
|
|
|
Yeah, I would guess you are right.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|