just PRE tags will do, it does not make sense to nest CODE and PRE tags; it may have had some use long ago, it does not today.
Luc Pattyn Have a look at my entry for the lean-and-mean competition; please provide comments, feedback, discussion, and don’t forget to vote for it! Thank you. Local announcement (Antwerp region): Lange Wapper? Neen!
My guess is that you have a number in textBox3 that is less than zero or equal to or greater than the .Count of your "silici" List. If you try to remove something at an index that doesn't exist the ArgumentOutOfRangeException is thrown. What is the value of "silineceksirasi" when you reach the silici.RemoveAt(silineceksirasi); statement? Make sure it's not equal or greater than the List.Count. Good luck!
silici.RemoveAt(silineceksirasi); ----> I GET MİSTAKE WHEN ı CLİCK BUTTON3!!!
Lets look closer at the List<(Of <(T>)>).RemoveAt Method method:
// Syntax publicvoid RemoveAt(
Exception Condition ArgumentOutOfRangeException index is less than 0.
index is equal to or greater than Count.
ArgumentOutOfRangeException is thrown when a method is invoked and at least one of the arguments passed to the method is not
nullNothingnullptra null reference (Nothing in Visual Basic) and does not contain a valid value.
The only programmers that are better C# programmers, are those who look like this ->
But if I read your code correctly (and I'm sorry, but it's a bit hard when you don't use the pre tags and have chosen names that doesn't make any sense if you don't speak turkish(?)) this is what happens when you click button3:
1. You create a new bt object.
2. You call the silgi method on that object.
At this point your bt object's member silici does not contain any items. It's just an empty List and when you try to remove an item from that empty list you get the exception thrown.
I think you need to do some reading when it comes to objects and the creation of new objects. Are you sure you want to create 3 different buton objects, or is your intention to create one bt object and add things to its "silici" List?
i am really pleased for your help and thanks for your assistance . moreover, i am new on C# and i will be more clear in my question in the future and that is right i need some reading. and i will not use turkish word in the future
No worries, and you'll be doing yourself a big favour if you learn a bit about this.
Check OriginalGriff's posting below - that should really get you started in understanding what you need to do to make things work. Good luck!
I have a C# Silverlight 3 app composed of 2 calendar controls. Both have their own SelectedDateChanged event hooked up in the constructor of the class. When user changes the date in one of the controls, the SelectedDateChanged event is raised and some code is executed, mainly to update the SelectedDate property of the other control, but this will also raise the event in the other control as well. I don't want this to happen so, inside the code, before updating the SelectedDate property I disconnect the event in the other control, preventing it to be raised. The problem is that, at the end, when the event is reconnected, it fires, making this logic useless. Is there anyway to do the reconnection without firing the event?
public partial class Page1: UserControl
// Hook events in the Constructor
calendarCheckInDate.SelectedDateChanged +=new EventHandler<SelectionChangedEventArgs>calendarCheckInDate_SelectedDateChanged) ;
// Call event in normal operation
private void calCheckInDate_SelectedDateChanged(object sender,SelectionChangedEventArgs e)
// disconnect event on other control
calendarCheckOutDate.SelectedDateChanged -= calendarCheckOutDate_SelectedDateChanged;
// run some business logic code
calCheckOutDate.SelectedDate.Value = someothervalue;
I can't say why the event is being raised; from what you have shown it shouldn't be raised. However, an alternate way to handle the problem would be to not remove the handlers at all. Instead you could use a guard flag to determine if you are changing the value from inside the other handler.
I've applied your sugestion and it works. However, since the "finally" clause executes before the event in the other control is raised, I moved the "inHandler = false" inside the other control.
I really would have preferred to disconect the event but your idea does the work as well.
I have constructed two straightforward named pipes, but problem is how to start them off together in their own threads in order to commence the transfer of messages.
Do some research, I have noticed that some of my solution may be found in delegates using begin invoke, invoke and end invoke. Unfortunately, I need some help as I am little new to this.
So, could someone please advise me how it would be possible to give a named pipe client stream and a named pipe server stream their own thread and to start them off together in their own thread with using delegates?
Hi everyone, i wanted to know if someone here knows where could i find some tutorials to accomplish the following:
I want to make a silverlight app that shows in a main screen a pictures of a room, let´s say a living room, and i want to have a small menu at the left with a scroll bar with different things in it(different lamps, flowers, candels, etc.) and what i want to do is to drag and drop the desired element and place it into the main picture (living room).
Im pretty much a newbie so any tutorial that you can point at will be really usefull.
First, let me say that I am not a C# programmer. Complete newb here... Don't hate me because I'm beautiful...
I am trying to create a drop-dead simple application that will set a function callback address in the C++ COM dll to point to a C# function in the demo application. (This is for a sample application to demonstrate our API to potential users.) I have it working for both C++ and Visual Basic, but thus far, C# success is eluding me.
Here is what I have done...
Created a simple form with three text boxes that will be filled with XYZ values when everything works.
Within the namespace of my app (TestCSharpApp... so I lack imagination... sue me...) I have created a delegate function like this.
public delegate void coordCallbackFunction(double x, double y, double z, int buttonNumber );
In my public partial class Form1 : Form class, I have the function I want to call.
publicvoid coordHandler(double x, double y, double z, int buttonNumber)
xCoord.Text = x.ToString();
yCoord.Text = y.ToString();
zCoord.Text = z.ToString();
Finally, In the form load function I have this code.
MyCOMInterfaceLib.MyCOMClassClass myApi = new MyCOMInterfaceLib.MyCOMClassClass();
myApi.coordCallback += new coordCallbackFunction(this.coordHandler);
I realize that myApi will go away right after setting up the callback, but I am just trying to get it to compile. I'll worry about details later.
When I compile the program I get this error...
Error 1 Cannot implicitly convert type 'TestCSharpApp.coordCallbackFunction' to 'MyCOMInterfaceLib._IMyCOMClassEvents_coordCallbackEventHandler' C:\Temp\TestCSharpApp\Form1.cs 38
I have included the MyComInterfaceLib in my list of references. I can call functions from the COM dll and that works fine. The problem is setting the callback function using delegates.
It may not mean much, but the callback functions work fine in VB.Net, so I don't think the problem is in the COM dll.
Thank you for any help.
Last Visit: 31-Dec-99 18:00 Last Update: 24-Sep-23 17:41