Event Deletion in C#?

Cantersoft wrote on 12/28/2020, 10:12 AM

Hey guys! I need to delete the first event in a track as part of a Vegas script I've written in C#.

 

That event can be referred to by:

vegas.Project.Tracks[i].Events[0]

I looked through the API though and I can't figure out how to actually delete it. I saw "BaseList Remove", but I don't really know if that's the right method or how to use it because I'm not very experienced with C# anyway. How do I delete a track event?

Comments

wwaag wrote on 12/28/2020, 2:22 PM

Here's an example that removes the first event on the top track.

Track track = vegas.Project.Tracks[0];
TrackEvent evnt = track.Events[0];
track.Events.Remove(evnt);

 

AKA the HappyOtter at https://tools4vegas.com/. System 1: Intel i7-8700k with HD 630 graphics plus an Nvidia RTX4070 graphics card. System 2: Intel i7-3770k with HD 4000 graphics plus an AMD RX550 graphics card. System 3: Laptop. Dell Inspiron Plus 16. Intel i7-11800H, Intel Graphics. Current cameras include Panasonic FZ2500, GoPro Hero11 and Hero8 Black plus a myriad of smartPhone, pocket cameras, video cameras and film cameras going back to the original Nikon S.

Cantersoft wrote on 12/28/2020, 10:49 PM

Here's an example that removes the first event on the top track.

Track track = vegas.Project.Tracks[0];
TrackEvent evnt = track.Events[0];
track.Events.Remove(evnt);

 

Thanks for the example!

Aha, I had written

vegas.Project.Tracks[i].Events[0].Remove(vegas.Project.Tracks[i].Events[0])

when I should've written

vegas.Project.Tracks[i].Events.Remove(vegas.Project.Tracks[i].Events[0])

.