15,908,445 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by Member 12558924 (Top 23 by date)
Member 12558924
7-Apr-17 7:28am
View
thank you for your help!!!
Member 12558924
7-Apr-17 7:16am
View
thanks alot it's work fine. and what can i do if i want it to an extern file so that it can be use for others html file?
Member 12558924
7-Apr-17 6:56am
View
Thank you a lot, but it still does not work on my side. maybe i've missed something. Should I include something else?
Member 12558924
1-Mar-17 5:08am
View
Sorry, but I am not satisfied with my personal research. This is why I am here and you did not answer the question poses but it does not matter. Goodbye and thank you for your time.
Member 12558924
1-Mar-17 4:37am
View
yes l saw your code but what about the messagebox? i want to use it
Member 12558924
1-Mar-17 3:48am
View
Thanks first for your help. Please can you really tell me what i should use instead Directory.EnumerateFileSystemEntries so that it can count how much csv file are contained in zip file?
Member 12558924
1-Mar-17 2:34am
View
ok it's done. Thanks
Member 12558924
28-Feb-17 9:56am
View
I wanted to program a message that tells me if there is one or more cvs file present in the zip file and gives me the number of files contained in this zip. Is not that possible? i tried this:
var = comboBox1.SelectedItem.ToString();
fullpath = fbd.SelectedPath + "\\"+ var;
comboBox2.Items.Clear();
if (File.Exists(fullpath))
{
ZipArchive zip = ZipFile.OpenRead(fullpath);
MessageBox.Show(Directory.EnumerateFileSystemEntries(fullpath, "*.csv").ToList<string>().Count + " csv file(s) present"); // get error here
foreach (ZipArchiveEntry entry in zip.Entries)
{
comboBox2.Items.Add(entry.FullName); // fill comboBox2 with *.csv files from selected zip file
}
zip.Dispose();
}
else
{
MessageBox.Show("no csv file(s) present");
}
Member 12558924
28-Feb-17 8:54am
View
Hello,
how can i check the contents of zip file before read it? i tried with File.Exist(fullpath), but no check is done. fullpath contains the directory and the zip filename. thank for your time
Member 12558924
22-Feb-17 2:14am
View
Morning Maciej and thank you for help. I can't close the zip file however a tried to close zipfile or zip. I get an error like:"string or ZipArchive does not contain a definition for 'close' and no extension method 'close' accepting a first argument of type string or ZipArchive could be found." This is all the code in the method, you can maybe find why is not working. Thank again!!!
My Code:
private void button1_Click_1(object sender, EventArgs e)
{
// Create an Instance of FolderBrowserDialog Class
OpenFileDialog ofd = new OpenFileDialog();
// Set an Initial SelectedPath property
ofd.InitialDirectory = @"\\servername";
string filter = "*.zip";
// Show the OpenFileDialog.
DialogResult result = ofd.ShowDialog();
if (result == DialogResult.OK)
{
string fullPath = ofd.FileName;
string directory;
directory = fullPath.Substring(0, fullPath.LastIndexOf('\\'));
// Write the Selectedpath to the TextBox nearby the Button
textBox1.Text = directory;
if (File.Exists(fullPath))
{
List<string> files = Directory.EnumerateFiles(directory, filter, SearchOption.AllDirectories)
.Where(x => File.GetLastWriteTime(x) >= startDate && File.GetLastWriteTime(x) <= endDate)
.Select(x => Path.GetFileName(x))
.ToList();
comboBox1.Items.Clear();
foreach (string zipfile in files)
{
this.comboBox1.Items.Add(zipfile); // fill cbx1 with *.zip files
// zipfile.Close(); cuz not working
}
comboBox2.Items.Clear();
ZipArchive zip = ZipFile.OpenRead(fullPath);
foreach (ZipArchiveEntry entry in zip.Entries)
{
comboBox2.Items.Add(entry.FullName); // fill cbx2 with *.csv files
// zip.Close(); also not working
}
}
}
}
Member 12558924
21-Feb-17 8:19am
View
This works, but only for the first selected filename! So when I select another zip file in my combobox1, my code does not populate the combobox2 with the elements of the newly selected file. It is always the same data in combobox2. How do I change my code to work? Thanks
Member 12558924
21-Feb-17 6:06am
View
Thank you very much, it works very well !!! And how can I fill a new combobox2 with the entries of each zipfile? I mean, I select a zip file in my combobox1, its entries like test.txt will appear in the combobox2 and the entries of that test.txt will also appear in a datagridview as a table. How can I do that in the same code?
i've tried this to populate the new combobox2, but it's not working. I get an error and have to break the code when it run. concerning the datagridview i don't have idea.
ZipArchive zip = ZipFile.OpenRead(directory);
foreach (ZipArchiveEntry entry in zip.Entries)
{
comboBox2.Items.Add(entry.FullName);
}
It would be very nice to help me one last time.
thanks again an all
Member 12558924
21-Feb-17 2:59am
View
It's done! should l made it in the code behind of the DateTimePicker Control or in the Button Control where i write all this code? I made it in the code behind of the DateTimePicker Control but i'm not sure. Thanks a lot.
Member 12558924
21-Feb-17 2:21am
View
Hey,
Many thanks!!! It works for the zip file, but is it possible to leave the choice to the user to enter his own date range whenever he needs it using the DateTimePicker Control on my Forms(Interface)? In addition I also want to be able to enter the exact time of the chosen date. That what i've tried does not work.
Any ideas? Thank you in advance.
Member 12558924
17-Jun-16 6:34am
View
Deleted
Hello @ all,
Thanks for helping me with your idea and solution.
i 've solved the Problem using do{}while. now i can read all Element Group into my Datagrid but without the Attribut of Element Name= "path1". do you have idea, how i can get the Attribut?
Member 12558924
13-Jun-16 9:16am
View
Hi Dora and thank you for your answer.
i've try it but the name of my DataGrid is not recognized by my ViewModel class. it Show me a error message like that:"DG is not present in this context"
Member 12558924
12-Jun-16 10:58am
View
thank you!!!
I could not ask like other it the reason why I have done so
Member 12558924
12-Jun-16 9:57am
View
Deleted
<xmlfile>
<element name="PATH1">
<type>int
<values>D:\
<comment>...
<element name="PATH2">
<type>str
<values>D:\
<comment>...
</xmlfile>
Member 12558924
12-Jun-16 9:53am
View
Deleted
the oder xmlfile that not work look like this:
it can be more than 2 Element Group
Member 12558924
12-Jun-16 9:50am
View
Deleted
the Binding to DataGrid look like this:
<datagrid x:name="DG" itemssource="{Binding model.Element}" grid.column="2" grid.row="3" autogeneratecolumns="False" canuseraddrows="True" canuserdeleterows="True" selecteditem="{Binding model.SelectedParameter, Mode=TwoWay, Converter={StaticResource ParameterConverter}}">
Member 12558924
1-Jun-16 6:53am
View
is it another way to solve it? i can't use the code-Behind to do this
Member 12558924
1-Jun-16 6:15am
View
Deleted
sorry my Combobox look like:
<combobox name="Combo" text="filename" selecteditem="{Binding DataModel.DataConfig.SelectedExeDatei, Mode=TwoWay }" itemssource="{Binding DataModel.ExeDateiList}" margin="5,2,5,10" isreadonly="True" iseditable="True" width="Auto" horizontalalignment="Center">
Member 12558924
1-Jun-16 6:08am
View
Deleted
Sorry my Combobox look like:
<combobox name="Combo" itemssource="{Binding DataModel.ExeDateiList}" selecteditem="{Binding DataModel.DataConfig.SelectedExeDatei, Mode=TwoWay }" text="filename" horizontalalignment="Center" width="Auto" iseditable="True" isreadonly="True" margin="5,2,5,10">
Show More