Your method works fine, but it looks like it is not possible to check if all elements equal 0 in a 2D array. I couldn't find a way to do that for a 2D array as I did for a 1D. Is there a way to check if all elements is 0 in a 2D array?
mfcuser
Posts
-
Using Generic Method to Determine if All Elements in an Array is Zero -
Using Generic Method to Determine if All Elements in an Array is ZeroIt seems to work fine now
-
Using Generic Method to Determine if All Elements in an Array is ZeroHow do you declare item in this case?
-
Using Generic Method to Determine if All Elements in an Array is ZeroI want to know how to do that. I can use foreach and for loop, but I prefer to use the array class. Assume I have my array like
int[] arrayData = { 1, 3, 5, 0, 6 };
By using .All generic method, it is possible to do something like that to determine if all elements are zero
arrayData.All //this is where I have the problem
So how can I use the .All to determine if all elements in the array is 0
-
Runtime Class DeclarationI added a public value something like that
set { RichTextBox = value; }
From the control, I set the richtextbox visibility to false. I built it; it seemed to work fine. Now, when I dragged the control to the form, then dropped a richtextbox to test it. I can see a combo in the property where I can select that richtextbox name. However when I selected it, the program exited abruptly which seemed to be an exception to me. -
Runtime Class DeclarationThe title may not be right, but I don't know how to call it. I want to know how to make a class adapt to a particular of control at run time. I am building a rich textbox control similar to the one below. http://www.codeproject.com/cs/miscctrl/richtextboxextended.asp Everything works fine, but I don't want the control to adapt to the richtextbox at the time I am building it. I want the users to choose specific textbox when they drag the component to the form. In that case, when they drag the control to the form, only the toolbar portion will show, not the text area. From the toolbar property, they can choose the richtextbox to associate the component with. I want this type of functionality, in that case the richtextobx can be located anywhere in the form. It does not have to be located right below the toolbar.
-
XPO vs SQL Statement or Persistent Object VS SQLI want to develop an application that use SQL statment. I am currently learning SQL. I want to know which one is better to use, XPO or SQL. DevExpress does provide a Persistent Object component. I am not an experienced database programmer. I am just learning SQL. Which one will you recommend for me to use between xpo and sql statement.
-
EventHandler not FireIt is working fine now. About if I have several menu items. There must be a way to pack them to an array rather than doing it one by one. So the way I had "Data", "Keyboard", "Telephone" was incorrect. The menu items need to have their own variable to identify them rather than single string.
-
EventHandler not FireThe computer item is a subitem of the file menu. So how can I assign it to the computer item. How can I fix that?
-
EventHandler not FireI want to know why this does not work. It is very simple, but when I click on it, it does not show the message box. I want to know why.
MainMenu mainMenu1 = new MainMenu(); MenuItem menuItem1 = new MenuItem("&File"); menuItem1.MenuItems.Add("Data"); menuItem1.MenuItems.Add("Computer"); menuItem1.MenuItems.Add("Keyboard"); menuItem1.MenuItems.Add("Telephone"); menuItem1.Click += new EventHandler(OnComputer); void OnComputer(object sender, EventArgs e) { MessageBox.Show("You click on computer", "Computer Click"); }
-
Database Explorer Database ConnectionAssume that I am working with a single database. I am talking about a single database file. Now, both access and sql server. I know the app.config file provides the database connection information. I wonder if I can have an option for a single database connection where user can decide either access or sql. It seems like each of them will require its own data adapter. I want to know if that is possible and how can I do that. For example, assume that I do have a database name "nwnd", this database depends on the user's choice. For example, if the user wants to choose ms access, the application will use ms access. If the use chooses to use sql, the application will use sql. The problem is, I cannot find a way to choose the database connectivity for a single component. Assume that if the user choose ms access, the ms access table will display on the grid. Also if the user chooses ms sql, the ms sql table will display on the grid. I cannot find a way to do that from the database explorer or wizard. It seems like that can only be done hard coding or manually. I will appreciate your comment.
-
Form Closing Problem and MessageBox Independence [modified]I am not using MDI, my application is simply single document or single form. Also I already tried this.close but it does not work by the way this is the simple code
DialogResult myMessage; messageResponse = MessageBox.Show("message", "title", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (myMessage== DialogResult.OK) { Form2 form2= new Form2(); form2.ShowDialog(); Form3.ActiveForm.Close();//this does not work here, it does not matter what form that I use }
-
Form Closing Problem and MessageBox Independence [modified]Maybe I have to use a form to do that rather than using a messagebox. It seems like a message box depends on the form it is being called. I do have a form where I have a line of code to call a dialog. From that dialog, I open another form. When the user click ok, I want the first form to close, however it does not close. here is what I am talking about for example, assume that my form is form 3, inside my form 3, I have a dialog to open form two. When the user clicks ok, form 2 will open where form 3 will close, however form 3 never closes inside form 3 I have if (dialogresponse == dialogresult.ok) form3.activeform.close(); then create an open form 2 The way to look at it, form 3 only close after form 2 open and close it does not work, it seems like I have to do that in another form. I don't want fo have a form for that only. Maybe I am missing something. -- modified at 20:02 Thursday 14th December, 2006
-
Dynamic Data ConnectionWhat is the difference between oledbconnection and sqlconnection? I have been using oledbconnection. I have seen a lot of people using oledbconnection. I am using ms accesss just for testing, that will change later when I get sql express working. Can I use sql connection for ms access database?
-
Table Update Via Table AdapterThe datble did update. There was a directory problem. Visual studio keeps two copy of the database and only one was updated. The only problem is that it keeps updating on the same row. I want it to update the nextrow thereafter.
-
Table Update Via Table AdapterThe following code work, but for any reason, the data did not save on the table. I can look at the data on the grid, but it is not saved.
table1TableAdapter.Insert("name1", "name2", "name3"); table1TableAdapter.Update(db1DataSet1.Table1);
the data did not save on the table. I want to know why and how to fix it. -
Dynamic Data ConnectionUsing vs2005, from the data explorer window, I can add a new connection and bring my data in. Using the datagrid view, I can attach a table to view my data. I can also use sql statement to view the data table to the grid. Although I haven't tried both of them on the same application. It looks like it is fater to display the data to the grid from the data explorer than using sql statement. What I mean, I mean that an application that use the database explorer to bring data in should be faster than one that use sql statement. I tried both of them in different application, I have seen that it always take more time for the sql statement to run than fill the grid. The way I look at it, by using the databse explorer, when the application is loaded or run, the connection and the data tables are also initializeed. Therefore, it is faster, which is opposed to runing sql statement. When I use sql statement here, I mean I mean something like oledbconnection. Let me know if I am right.
-
Database Connection and SQL CommandUsing vs2005, from the data explorer window, I can add a new connection and bring my data in. Using the datagrid view, I can attach a table to view my data. I can also use sql statement to view the data table to the grid. Although I haven't tried both of them on the same application. It looks like it is fater to display the data to the grid from the data explorer than using sql statement. What I mean, I mean that an application that use the database explorer to bring data in should be faster than one that use sql statement. I tried both of them in different application, I have seen that it always take more time for the sql statement to run than fill the grid. The way I look at it, by using the databse explorer, when the application is loaded or run, the connection and the data tables are also initializeed. Therefore, it is faster, which is opposed to runing sql statement. When I use sql statement here, I mean I mean something like oledbconnection. Let me know if I am right.
-
Dataset and BindingSourceI posted that in the wrong forum, let me post it here ======================================================I am using a commercial grid to display my data. I don't have any problem to display the whole table to the grid. For instance, the following code displays a whole table to the grid. grid1.SetDataBinding(table1BindingSource); Now, I only want to display the FirstName and the LastName I have the following in my form table1BindingSource and db1DataSet From db1DataSet, I can see the following by intellicense; my table names Tabl1 from intellicense I can see Table1.FirstNameColumn and Table1.LastNameColumn; My question, how can I use table1BindingSource and db1DataSet to display only the firstname and the lastname rather than the whole table?
-
BindingSource and DataSetI am using a commercial grid to display my data. I don't have any problem to display the whole table to the grid. For instance, the following code displays a whole table to the grid.
grid1.SetDataBinding(table1BindingSource);
Now, I only want to display the FirstName and the LastName I have the following in my form table1BindingSource and db1DataSet From db1DataSet, I can see the following by intellicense; my table names Tabl1 from intellicense I can see Table1.FirstNameColumn and Table1.LastNameColumn; My question, how can I use table1BindingSource and db1DataSet to display only the firstname and the lastname rather than the whole table?