Click here to Skip to main content
15,898,588 members
Home / Discussions / C#
   

C#

 
QuestionRe: datagridview in datagridviewcomboboxcolumn Pin
jojoba201111-Apr-10 4:52
jojoba201111-Apr-10 4:52 
AnswerRe: datagridview in datagridviewcomboboxcolumn Pin
Dan Mos11-Apr-10 16:15
Dan Mos11-Apr-10 16:15 
QuestionRe: datagridview in datagridviewcomboboxcolumn Pin
jojoba201111-Apr-10 6:22
jojoba201111-Apr-10 6:22 
AnswerRe: datagridview in datagridviewcomboboxcolumn Pin
Dan Mos11-Apr-10 16:17
Dan Mos11-Apr-10 16:17 
AnswerRe: datagridview in datagridviewcomboboxcolumn Pin
Luc Pattyn11-Apr-10 6:34
sitebuilderLuc Pattyn11-Apr-10 6:34 
QuestionRe: datagridview in datagridviewcomboboxcolumn Pin
jojoba201111-Apr-10 18:11
jojoba201111-Apr-10 18:11 
AnswerRe: datagridview in datagridviewcomboboxcolumn Pin
NavnathKale12-Apr-10 0:28
NavnathKale12-Apr-10 0:28 
QuestionIs this code Horror ? Pin
Mohammad Dayyan11-Apr-10 0:23
Mohammad Dayyan11-Apr-10 0:23 
Hi,
I've written the following code for batch renaming.
Is it Horror Wink | ;) ? if so, how should I fix it?

private void rename_Click(object sender, EventArgs e)
{
    DialogResult result = MessageBox.Show("Are you sure ?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
    if (result == DialogResult.Yes)
    {
        Thread tr = new Thread(new ThreadStart(chnTarget));
        tr.Start();
    }
}

private void chnTarget()
{
    this.Invoke(new ThreadStart(ChangeName));
}

bool cancel = false;
private void ChangeName()
{
    Random rand = new Random(DateTime.Now.Second);
    string folder_path = SelectedPathText.Text;
    long progress_value = 0;
    string new_filename = "";
    cancel = false;

    progressBar1.Minimum = 0;
    progressBar1.Value = 0;

    try
    {
        string[] FullPathFileNames = System.IO.Directory.GetFiles(folder_path);
        progressBar1.Maximum = FullPathFileNames.Length;

        if (FullPathFileNames.Length == 0) throw new Exception("No File Found \n");

        foreach (string filename in FullPathFileNames)
        {
            if (cancel)
            {
                labelResult.Text = "Canceled";
                break;
            }

            progress_value++;

            try
            {
                if (!radioRandom.Checked)
                {
                    new_filename = folder_path + "\\" + textBoxTemplate.Text + progress_value + Path.GetExtension(filename);
                }
                else
                {
                    if (checkBoxOmitExtension.Checked)
                        new_filename = folder_path + "\\" + rand.Next();
                    else
                        new_filename = folder_path + "\\" + rand.Next() + Path.GetExtension(filename);
                }

                File.Move(filename, new_filename);
                Application.DoEvents();
            }
            catch { }

            progressBar1.Value = (int)progress_value;
            progressBar1.Update();
        }

        labelResult.Text = "Complete";
        cancel = false;
    }
    catch (Exception ex)
    {
        labelResult.Text = ex.Message;
    }
}


The Project of above snippet code:
Batch Renamer in C#[^]
AnswerRe: Is this code Horror ? Pin
Luc Pattyn11-Apr-10 0:28
sitebuilderLuc Pattyn11-Apr-10 0:28 
GeneralRe: Is this code Horror ? Pin
Mohammad Dayyan11-Apr-10 0:30
Mohammad Dayyan11-Apr-10 0:30 
GeneralRe: Is this code Horror ? Pin
Luc Pattyn11-Apr-10 0:43
sitebuilderLuc Pattyn11-Apr-10 0:43 
GeneralRe: Is this code Horror ? Pin
Mohammad Dayyan11-Apr-10 0:49
Mohammad Dayyan11-Apr-10 0:49 
GeneralRe: Is this code Horror ? Pin
Luc Pattyn11-Apr-10 0:53
sitebuilderLuc Pattyn11-Apr-10 0:53 
GeneralRe: Is this code Horror ? Pin
tangname11-Apr-10 1:27
tangname11-Apr-10 1:27 
QuestionHow to call "Desktop Property" screen in C# Pin
pcphuc10-Apr-10 22:56
pcphuc10-Apr-10 22:56 
AnswerRe: How to call "Desktop Property" screen in C# Pin
Ravi Bhavnani10-Apr-10 23:05
professionalRavi Bhavnani10-Apr-10 23:05 
GeneralRe: How to call "Desktop Property" screen in C# Pin
pcphuc10-Apr-10 23:09
pcphuc10-Apr-10 23:09 
AnswerRe: How to call "Desktop Property" screen in C# Pin
Abhinav S10-Apr-10 23:09
Abhinav S10-Apr-10 23:09 
AnswerRe: How to call "Desktop Property" screen in C# Pin
Luc Pattyn10-Apr-10 23:11
sitebuilderLuc Pattyn10-Apr-10 23:11 
QuestionC# Help Pin
jojoba201110-Apr-10 18:04
jojoba201110-Apr-10 18:04 
AnswerRe: C# Help Pin
PIEBALDconsult10-Apr-10 18:12
mvePIEBALDconsult10-Apr-10 18:12 
QuestionRe: C# Help Pin
jojoba201110-Apr-10 18:21
jojoba201110-Apr-10 18:21 
AnswerRe: C# Help Pin
PIEBALDconsult10-Apr-10 19:07
mvePIEBALDconsult10-Apr-10 19:07 
AnswerRe: C# Help Pin
Jens Meyer10-Apr-10 19:18
Jens Meyer10-Apr-10 19:18 
AnswerRe: C# Help Pin
Eddy Vluggen10-Apr-10 22:37
professionalEddy Vluggen10-Apr-10 22:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.