|
What I can think of is to have a flag (boolean variable) in your form. Now, when you are changing selected cell through code, set this to false and make it true again in the end of event. Something like this:
bool isChangedByUser = true;
.
.
.
isChangedByUser = false;
.
.
.
void dgv_SelectionChanged(object sender, EventArgs e)
{
if(isChangedByUser)
{
}
isChangedByUser = true;
}
|
|
|
|
|
Thank for the reply.
The problem is not that I'm changing the selection - in this case the problem is easy to solve. The problem is that the event is fired when the form is initially opened and rows are automatically added. Then, when the first row is (automatically) selected, the event is fired.
Eyal.
|
|
|
|
|
Following are two of the various ways you can do this:
1. Attach the event handler once you are done with filling the DataGridView with data.
2. Have a boolean variable and use it to decide if the code inside the event handler should be executed or not.
|
|
|
|
|
Hi,
i want to hide cmd prompt while executing or running an .bat file..
i have an exe inside my .bat file..
Simply want to run .exe without showing the command prompt through bat file..
Regards,
Pawan
|
|
|
|
|
How is this related to C#?
|
|
|
|
|
Hi,
StreamWriter sw = new StreamWriter(@"Z:\" + txtName.Text + ".bat");
sw.WriteLine("START /d E:\\Stock\\StockView\\bin\\Debug Stock.exe % "+result);
sw.Close();
This is what i created through C# code..
I don't know what i need to include before or after "START" of sw.WriteLine to hide the cmd prompt..
That's y i posted it in C#.
|
|
|
|
|
Use @echo off on the first line of your bat file.
|
|
|
|
|
Hi
I applied @echo off, but still it is not solved the issue.
|
|
|
|
|
Hi,
In a datagridview, I've included a combobox column in columns collection property.
How to handle combobox selectedindexChanged event.
And how to create combobox object for a particular cell in combobox column.
Please guide me. Thanks in advance.
|
|
|
|
|
Brad North wrote: How to handle combobox selectedindexChanged event.
You can handle the CellValueChanged event for the DataGridView and check if the cell whose value was changed is the ComboBoxCell.
Brad North wrote: how to create combobox object for a particular cell in combobox column.
Why do you want to do this?
|
|
|
|
|
|
|
first of all thank you for ur reply ..
sir u gave me the link in which video convert into another video format .
i want to convert/split the video in JPEG PICTURES..
but again thank you!!..
*Video is consist of Picture in sequence..
i love pRogRamming.
|
|
|
|
|
You can exctract single/multiple frames from a video file with ffmpeg.
from the documentation:
* You can extract images from a video, or create a video from many images:
For extracting images from a video:
ffmpeg -i foo.avi -r 1 -s WxH -f image2 foo-%03d.jpeg
This will extract one video frame per second from the video and will output them in files named `foo-001.jpeg', `foo-002.jpeg', etc. Images will be rescaled to fit the new WxH values.
If you want to extract just a limited number of frames, you can use the above command in combination with the -vframes or -t option, or in combination with -ss to start extracting from a certain point in time.
For creating a video from many images:
ffmpeg -f image2 -i foo-%03d.jpeg -r 12 -s WxH foo.avi
this documentation is for the console app, but the lib should also be able to do it.
modified on Thursday, April 22, 2010 6:36 AM
|
|
|
|
|
ok ,, let me see again deeply !!
and if u have any code example, then please give me that also!!
thanks!!
i love pRogRamming.
|
|
|
|
|
sir i found the way in FFmpeg Document ..
but i am totally confuse that how to RUN this Command Line arguments ??
*i knw how to run COMMAND LINE PROGRAMS.. but where is the EXE of the ffmpeg??
i love pRogRamming.
|
|
|
|
|
you can:
a) 1. download the ffmpeg source code from svn://svn.ffmpeg.org/ffmpeg/trunk ffmpeg with a SVN client like tortoiseSVN or AnkhSVN.
2. Then compile the source using MinGW.
b) google around for "Unofficial ffmpeg windows build"
For the implementation you basicly have 2 chooses:
a) using the ffmpeg dll files, and p/invoke them in C# allowing you to access the unmanaged methods in those dll files in your managed C# code. (or you can save yourself some time and go to http://sourceforge.net/projects/sharpffmpeg/[^]
b) using the Process.Start method in C# to start the ffmpeg console application with the correct arguments.
modified on Thursday, April 22, 2010 7:53 AM
|
|
|
|
|
Thanks
i love pRogRamming.
|
|
|
|
|
|
No problem
|
|
|
|
|
First question here! Been on this problem for two days now and can't seem to find a solution.. CodeProject has always been a great reference for me, so I hope you guys can help! Please find a simplified example of my application below.
Ingredients:
* public class VehicleClass
** public bool Ignition { get; set; }
** public static void SetIgnition(object vehicle)
* public partial class MainForm : Form
** TextBox "txtIgnitionStatus"
So, in the MainForm class I create an instance of Vehicle and I link the textbox on the MainForm (txtIgnitionStatus) to the Ignition property of that Vehicle class:
private VehicleClass Vehicle = new VehicleClass();
public MainForm()
{
txtIgnitionStatus.DataBindings.Add(new Binding("Text", this.Vehicle, "Ignition"));
}
The SetIgnition method in the vehicle class a TcpClient to listen for incoming TcpPackets and sets the Ignition status of the Vehicle when necessary:
public static void SetIgnition(object obj)
{
VehicleClass vehicle = obj as VehicleClass;
switch(dataString)
{
case "ON":
vehicle.Ignition = true;
break;
case "OFF":
vehicle.Ignition = false;
break;
default:
vehicle.Ignition = false;
break;
}
..
}
Here is the instantiation of the thread that handles the tcp communication:
readThread = new Thread(new ParameterizedThreadStart(VehicleClass.SetIgnition));
readThread.Start(this);
(readThread is a private class member of VehicleClass)
Now to the problem.. When the Ignition property of the vehicle class is set to "true" (ie. when a Tcp packet arrives that contains the data string "ON"), txtIgnitionStatus on the MainForm should display "True" instead of "False". It never gets that far though, because I get the following error:
Cross-thread operation not valid: Control 'txtIgnitionStatus' accessed from a thread other than the thread it was created on.
Fair enough.. I understand I'm trying to change a control that is created on the UI thread, from another thread (the thread that is created inside the VehicleClass to handle the Tcp communication). But how do I go about avoiding this error?
After spending hours searching the internet, I think I might have found a solution in using the ISynchronizeInvoke interface in my VehicleClass, to be able to Invoke the Ignition property of the class.
First of all I would like to know if that is indeed the way to go?
And if so, how should I implement the interface members BeginInvoke, Invoke, InvokeRequired, etc.?
Because when I add the ISynchronizeInvoke interface to my class, and click Implement Interface, I have the following code lines added to my VehicleClass:
public IAsyncResult BeginInvoke(Delegate method, object[] args)
{
throw new NotImplementedException();
}
public object EndInvoke(IAsyncResult result)
{
throw new NotImplementedException();
}
public object Invoke(Delegate method, object[] args)
{
throw new NotImplementedException();
}
public bool InvokeRequired
{
get { throw new NotImplementedException(); }
}
.. but I have no idea how to fill them in!?
I hope my problem is clear to you, and hope even more that you'll be able to help me find a solution for it!
Many thanks in advance!
René
F1RST Racing
www.f1rstracing.nl
|
|
|
|
|
Hmmm, guess I used too much text then?
Still hope someone can help me out here. In the mean time I've made the app work without threads so I can continue working, but I like my GUI responsive!
F1RST Racing
www.1stracing.nl
|
|
|
|
|
Hi,
I have +20 comboboxes in my windows app. and thought its best to have the code in a seperate class and than call that class and pass the parameters using a constructor...
With this one function I hope to fill every combo box that i have in my application from a database table.
But not sure how to get started with it.
thanks
Wouter
|
|
|
|
|
First I'd say from a UI perspective 20+ comboboxes on a screen is probably not the best design. Think about breaking them up with tabs, or sub forms if it makes sense.
What you can do is iterate through the controls collection to find each combobox and set the properties accordingly. Or you could set DataBinding between the comboboxes and your datatable
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
I have 14 forms and 20 combo's in total, So each form has max 2 comboboxes on it.
|
|
|
|