Click here to Skip to main content
15,920,596 members

Comments by Member 10377493 (Top 11 by date)

Member 10377493 3-May-14 4:27am View    
Thnaks alot it solved my problemnow i am able to view diffferent pictures but now it doesnot dim the background
Member 10377493 22-Mar-14 14:41pm View    
thats correct thanks alot..i have corrected the mistake.
One more thing i want is that when user checks an item in the listview and presses add cart button it adds amount at the back end how can i do that for one as well as multiple items
Member 10377493 16-Mar-14 12:51pm View    
This is my code

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
using System.Collections;

namespace Assignment1b
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
DriveInfo[] drives = DriveInfo.GetDrives();
for (int i = 0; i <= drives.Length - 1; i++)
{
comboBox1.Items.Add(drives[i].Name);
comboBox1.SelectedIndex = -1;
}
}

private void gobtn_Click(object sender, EventArgs e)
{
ShowTreeViewItems(pathtb.Text);
ShowDirectoryItems(pathtb.Text);
}

private void listView1_ItemActivate(object sender, EventArgs e)
{
comboBox1.Text = comboBox1.Text + listView1.SelectedItems[0].Text + "\\";
//ShowTreeViewItems(comboBox1.Text.ToString());
//ShowDirectoryItems(comboBox1.Text.ToString());

string length = comboBox1.Text + listView1.SelectedItems[0].Text + "\\";
if (!Directory.Exists(length))
{
System.Diagnostics.Process.Start(length);
}
else
{
stack.Push(comboBox1.Text);
comboBox1.Text = length;
ShowDirectoryItems(length);
}
}
private void ShowTreeViewItems(string Path)
{
try
{
DirectoryInfo CurrDir = new DirectoryInfo(Path);
DirectoryInfo[] SubDirs = CurrDir.GetDirectories();
FileInfo[] Files = CurrDir.GetFiles();

treeView1.Nodes.Clear();

TreeNode parentNode = new TreeNode();
parentNode.Text = Path;
parentNode.ForeColor = Color.Black;
parentNode.BackColor = Color.White;
parentNode.ImageIndex = 2;
parentNode.SelectedImageIndex = 2;
treeView1.Nodes.Add(parentNode);

foreach (DirectoryInfo dir in SubDirs)
{
TreeNode childNode = new TreeNode();
childNode.Text = dir.Name;
childNode.ForeColor = Color.Black;
childNode.BackColor = Color.White;
childNode.ImageIndex = 2;
childNode.SelectedImageIndex = 2;
parentNode.Nodes.Add(childNode);
}

foreach (FileInfo file in Files)
{
TreeNode childNode = new TreeNode();
childNode.Text = file.Name;
childNode.ForeColor = Color.Black;
childNode.BackColor = Color.White;
childNode.ImageIndex = 0;
childNode.SelectedImageIndex = 0;
parentNode.Nodes.Add(childNode);
}
ShowDirectoryItems(Path);
}
catch (Exception e)
{
MessageBox.Show(e.Message.ToString());
}
}

private void ShowDirectoryItems(string Path)
{
DirectoryInfo CurrDir = new DirectoryInfo(Path);
DirectoryInfo[] SubDirs = CurrDir.GetDirectories();
FileInfo[] Files = CurrDir.GetFiles();

DateTime dateModified;

listView1.Items.Clear();

listView1.BeginUpdate();

foreach (DirectoryInfo dir in SubDirs)
{
ListViewItem item = new ListViewItem();
item.Text = dir.Name;
item.ImageIndex = 1;
listView1.Items.Add(item);
}

foreach (FileInfo file in Files)
{
ListViewItem item = new ListViewItem()
Member 10377493 16-Mar-14 12:36pm View    
I am going crazy with it and today it has to be submitted kindly help !!! ;(((((
Member 10377493 16-Mar-14 12:36pm View    
I tried but its not working when i select any folder in tree view after this code it gives the following exception.

************* Exception Text **************
System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Users\user\Documents\Visual Studio 2010\Projects\Assignment1b\Assignment1b\bin\Debug\libra'.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileSystemEnumerableIterator`1.CommonInit()
at System.IO.FileSystemEnumerableIterator`1..ctor(String path, String originalUserPath, String searchPattern, SearchOption searchOption, SearchResultHandler`1 resultHandler, Boolean checkHost)
at System.IO.Directory.EnumerateFiles(String path, String searchPattern)
at Assignment1b.Form1.treeView1_AfterSelect(Object sender, TreeViewEventArgs e) in C:\Users\user\Documents\Visual Studio 2010\Projects\Assignment1b\Assignment1b\Form1.cs:line 161
at System.Windows.Forms.TreeView.OnAfterSelect(TreeViewEventArgs e)
at System.Windows.Forms.TreeView.TvnSelected(NMTREEVIEW* nmtv)
at System.Windows.Forms.TreeView.WmNotify(Message& m)
at System.Windows.Forms.TreeView.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


************** Loaded Assemblies **************
mscorlib
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.18444 built by: FX451RTMGDR
CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll
----------------------------------------
Assignment1b
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:///C:/Users/user/Documents/Visual%20Studio%202010/Projects/Assignment1b/Assignment1b/bin/Debug/Assignment1b.exe
----------------------------------------
System.Windows.Forms
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.18408 built by: FX451RTMGREL
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System.Drawing
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.18408 built by: FX451RTMGREL
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.18408 built by: FX451RTMGREL
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Configuration
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.18408 built by: FX451RTMGREL
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Xml
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.18408 built by: FX451RTMGREL
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------

************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
<system.windows.forms jitdebugging="true">


When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.