I created a software in Windows Form Application that includes two Forms. In the form1 there are some textboxes and a listbox. One of textboxes i populated in a listbox with followin method. the name of textbox is xhirollogariaBox
Random rasti = new Random();
int numri = rasti.Next(10000000, 99999999);
xhiro = "1301" + numri;
xhirollogariaBox.Text = Convert.ToString(xhiro);
The problem is that i don't know how to make a method or a solution to prevent the future number not to be thw same as they are in thelistbox. So how to make a solution to prevent next entries (numbers) to be writen if the same number already exists in the listbox.
Also one other problem is that I don't know how to prevent another textbox to include numbers, probably that is something like regular expressions or whatever.
How to make this to not accept values less than zero. With other words if I press a button to draw a value that this "vlera" amount goes to minus values. If I press Add buton I can increase the value of "vlera", if a press draw button I can decrease the value of "vlera". How to make this to not draw values less than zero. Cheers
All I want to say is if you want to draw an amount from "vlera" that the result is a negative value, you could not be able to draw that amount. The Math.abs is not a solution, because the negative values converts to positive ones. So is there a way to say that if the result is less than zero, to recieve a message that you can not draw that amount because you dont have credits (just like in prepaid SIM cards).
So is there a way to say that if the result is less than zero, to recieve a message that you can not draw that amount because you dont have credits (just like in prepaid SIM cards).
Yes. Check the value and put up a message if someone tries to draw more from an account than the current balance. This is what I meant originally by saying "the ideal solution would be to disallow negative values in the first place".