TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Ali G
NA
51
38.4k
Passing the parameter...
Sep 30 2013 2:06 PM
pathname parameter which is created by button1_Click must be passed to button2_Click. How can I pass? (I know this is basic problem but I don't know.
===================================
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Drawing.Imaging;
namespace WindowsFormsApplication3
{
public partial class Form1 : Form
{
string pathname;
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
DialogResult result = folderBrowserDialog1.ShowDialog();
string pathname = @folderBrowserDialog1.SelectedPath;
int foldercount = Directory.GetDirectories(@pathname).Length;
int filecount = Directory.GetFiles(@pathname, "*.*", SearchOption.AllDirectories).Length;
int JPGcount = Directory.GetFiles(@pathname, "*.JPG", SearchOption.AllDirectories).Length;
label2.Text = pathname;
label4.Text = foldercount.ToString();
label6.Text = JPGcount.ToString();
label8.Text = (filecount - JPGcount).ToString();
}
private void button2_Click(object sender, EventArgs e)
{
FileInfo[] files = new DirectoryInfo(pathname).GetFiles("*.JPG");
==========================================
Reply
Answers (
2
)
Orderby clause
Printing contents of a Windows form in c#