private bool CheckStockAmount(ListView list, int pos) { Order_Service orderService = new Order_Service(); if (list.SelectedItems.Count > 0) { int stock = orderService.CheckStock(int.Parse(list.SelectedItems[0].SubItems[pos].Text)); if (stock < 1) { Messagelabel.Text = "Insufficient stock!"; return(true); } else { return(false); } } else { return(false); } }