|
I was mistake !
Thanks for alerting me !
Now plz ans my question and give me a great HELP!
|
|
|
|
|
jojoba2011 wrote: I was mistake !
Now you are ABSOLUTE TRUTH
|
|
|
|
|
Very Shame for CodeProject Users that nobody can solve this problem!
Plz HELP!
|
|
|
|
|
Hy,
It's not that they can't it's just a lot of work.
Look at Luc's answer bellow.
You have to implement/draw a custom datagridview => a lot of work.
modified on Sunday, April 11, 2010 10:34 PM
|
|
|
|
|
Unless the state of the art has evolved since two days ago, this[^] must be the answer to your question.
|
|
|
|
|
Plz give me more options and helps!
|
|
|
|
|
OK Just to help with what exactly you need to do is to develop classes just like CheckboxColumn
1. DataGridViewCheckBoxColumn
2. DataGridViewCheckBoxCell
3. DataGridViewCheckBoxCell.DataGridViewCheckBoxCellAccessibleObject
OR
You might achieve it by inheriting these classes to support your need
And Yes its a lot of work !!! Sorry it doesn't mean no one here on CodeProject want to help you.
BTW I think you already has an answer when you said "something like we have dateTimepicker in datagridviewcomboboxColumn" in you first post. Try to learn from that and implement DatagridView in place of datatimepicker
Makes sense ?
|
|
|
|
|
Hi,
I've written the following code for batch renaming.
Is it Horror ? 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#[^]
|
|
|
|
|
yes.
Seishin# is correct all the way.
|
|
|
|
|
Well, How should I fix it?
Where is the problem ?
|
|
|
|
|
you really want me to repeat what he said?
1. don't use lots of File.Move() without checking first that no conflicts (file overwrites) will result. Solution: add code to get a two-pass approach, first mimic the renames, and if all seem to be successful, then actually do them.
2+3. don't create a thread that doesn't do a thing. this.Invoke(X) causes X to run on the main thread. And don't abuse Application.DoEvents()
Solution: choose a different threading approach, e.g. use a BackgroundWorker, put the rename operation in its DoWork, and report progress using the ProgressChanged event.
|
|
|
|
|
|
you're welcome.
|
|
|
|
|
well done!
|
|
|
|
|
Hi all,
I need to call "Desktop Property" screen in C# but I do not know how to do this.
(Can I use process.start to do this?)
Pls help me to solve this problem.
Thanks in advance
|
|
|
|
|
This should do it:
Process p = new Process();
p.StartInfo.FileName = @"C:\WINDOWS\system32\rundll32.exe";
p.StartInfo.Arguments = "shell32.dll,Control_RunDLL desk.cpl,,3";
p.Start(); Of course you should compute the WinSys32 path instead of assuming the string shown in the code fragment. For other RUNDLL32 parameters, see this[^] link.
/ravi
|
|
|
|
|
Thanks so much, ravi.
Have a nice day
|
|
|
|
|
Try Process.Start(Desk.cpl);
|
|
|
|
|
Most control panels are easily accessible:
Process.Start("desk.cpl");
|
|
|
|
|
Is it possible to do this :
I wanna [C#]to automatically add some line of codes to any form that I add to my project ?
|
|
|
|
|
That depends on what you want to do, but probably not.
|
|
|
|
|
In VB6 I have seen this .
They done that with some add-in .
(I wanna to add some codes to my new form that adds to my project as defualt)
|
|
|
|
|
You need to be more specific.
|
|
|
|
|
|
jojoba2011 wrote: I wanna [C#]to automatically add some line of codes to any form that I add to my project ?
That's possible; if I read your question literally, then you'd want to modify a textfile. As the other posters suggest, it might be that you're looking for an automatically generated header.
If it's the latter that you want, it'll depend on the IDE. In SharpDevelop, you'd go to the "Tools" menu, pick "Options", go to the "Coding" node and edit your template. Visual Studio uses project- and itemtemplates that you can modify, but you could also opt to create a Macro.
I are Troll
|
|
|
|