You are doing the string comparison which may result true in all cases. Use id(chk.selectedvalue != 0) instead of id(chk.selectedvalue != "0"). Or you can also try id(chk.Checked == false)
SaqibRasheed
Posts
-
CheckBoxlist Select ALl -
Using WebCAM via Browser in asp.netIn simple words YES it is possible. Just google for some libraries or controls/components which can help you just do it for you. There are a lot of free libraries available for it; including libraries written in javascript
-
Is the Parent Instance Same For All Childs?If you mean that base class have same values whenever an object of its child classes are made then yes same class have 'same instance'. But, it is false in the sense that each time an object is created, its new instance is created in memory. So, when you are creating the instance of a child class, its respective base class' instance is also created in memory. And if you are creating two instances of two child classes derived from same base class, then two different instances of base class are also getting created in memory against both child objects.
-
kill the process using javasscriptJavaScript is the client side scripting language and you can not access Task Manager using JavaScript. So, you can not kill any process using JavaScript. Also, a website have access to only some specific folders of the drive and that access is very limited. You can not access anything outside those specific folders.
-
Treeview node folder imagesYou should create an ImageList and then assign images from the list to the nodes like node.ImageIndex = 0; this will assign the image at index =0 to the node. Better assign the images to the nodes while creating that node; either that node is the folder node or a list node.
-
Is try - catch block advisable?It is a good practice to catch exceptions; but if someone is sure about some exception then it is better to work on your code so that it doesn't throw any exception; let's say if divide by zero throws an exception then you shouldn't allow your code to reach to that point so that division by zero may occur. In that case it is not recommended to use the try-catch block but it is recommended to not let your code reach to that point so that that exception may occur.
-
WindowsApp and Website Share One DatabaseWeb-service approach will be more safe, and flexible; so, I don't think you should think about any other option when there are web-services. That is good thing that you are keeping such issues (like internet connection lost) in mind while working on your application. A better way could be to do a proper exception handling while connecting to the web-service as well as while calling methods of the web-service. If you are not connected, or some of the method has not returned the expected results this means something wrong happened. In that case you should keep backup of that record only and try re-inserting that record into the database laters. This entirely depends upon how much critical is that data for you with respect to usage point of view. You can try it re-inserting every 10 minutes of may be once in a day. But don't forget to remove the backup of that record once it is inserted into live database (For backup, you can use the same copy of database locally)
-
Retrieve all rows in MySQL stored procedure and put in in C# class.MySqlCommand cmd = new MySqlCommand("ProcName", new MySqlConnection("ConnectoinStringHere")); // ProcName should be the name of the procedure which you want to call cmd.CommandType = CommandType.StoredProcedure; cmd.Connection.Open(); MySqlDataReader dataReader = cmd.ExecuteReader(CommandBehavior.CloseConnection); // Now you have all the data in the dataReader. So, you can loop through the datareader like while (dataReader.Read()) { string name = dataReader["Name"].ToString(); // this will store the Name (which is a column_name in the database) to a local variable } dr.Close(); But it is suggested to not get the full data of a table into the memory unless you really require it.
-
C# Winforms GUI : Stack and Heap questionObjects are created on heap; and Application.Run is creating the object Form1 as new Form1(); so it will be created on heap. As, per my understanding, createsomething() will also go on heap as it is part of an object. But better look for memory allocation in .Net and you will have a clear idea about what goes on stack and what goes on heap.
-
Listbox suggestion from textboxI have worked with VS 2008 and there was no such property like autoComplete for TextBox. May be later versions of Visual Studio are having such property.
-
OOPProcedural coding is about procedures/functions. We write procedures which just take an input and produce an output. They don't have any kind of relation with another procedure. Sometimes they are just able to use some global or shared data when required. OOP is all about objects. We do write procedures/functions in OOP, but the main thing is the class. A class has a relation; it can be a parent or base class, it can be a child class. And then we do things on the objects created by those classes. As classes have relation so we can say that the the objects of those classes do have the relations also. For deeper understanding, you should check for articles online. Just google :)
-
Listbox suggestion from textboxYes you can do this. The events of the TextBox will help you in this case. You need to capture key events, may be KeyDown, KeyUp, or KeyPress help you in that case. In that event, write code for fetching the list which you need to bind with the listbox on the basis of the text entered in the TextBox and then bind it. Hope it will work :)