I second that! Do you ever sleep?
mprice214
Posts
-
New posts emailed - please be kind -
New posts emailed - please be kindUncle! I understand it's not a "flick of the switch". I'm not suggesting that they do that either. I initially asked how and if it could be done, that was all. Just because I had come across this functionality on other forums doesn't mean that I think CP should be shut down until it does have it. It's not worth it to me to suggest it on the Suggestion forum. If Luc wouldn't get all over me about removing messages, I probably would. :-D
-
Unable to Build Release Version of ProgramYour welcome. Hope it helped.
-
New posts emailed - please be kindI figured the hamsters were all the silicon gates that open and close, depending on what the software guys tell them what to do. I don't think the question was that perverse :^) It stems from having participated in other forums and is not a unique brain child of mine :-\ .
-
New posts emailed - please be kindIf someone wanted to inflict themselves with a daily single email per forum that shows 100+ lines of titles for new threads, does that sound so bad? I know my boss gets probably 25+ emails a day for enlargement techniques. While he may continue to be frustrated, which I cannot help, I know that if I could get a single email from the C# forum I could conceivably prevent frustration. But alas, I am also fine with searching through the threads. Just am doing it typically with a decent amount of leadtime.
-
New posts emailed - please be kindThanks. I've been on a couple of forums in the past where you could at least get a daily email indicating new posts for the previous day. Oh well......
-
Unable to Build Release Version of Programhttp://www.codeproject.com/Messages/1996551/Re-How-to-deploye-csharp-Application.aspx[^] or Google "deploying C# project" or similar.
-
New posts emailed - please be kindHi all, I search on CP how to have new posts on a message board emailed to me without success (obviously). Yes, I know that this may get the "what does this have to do with C#", etc., but it's somewhat related. Essentially, since I have asked enough dumb C# questions, maybe now I'm beginning to have the answers to some of the other dumb C# questions that are asked and therefore I could assist. However, the bigger reason may be I don't want to miss out when someone asks a really dumb question. (of course this could be one of those :laugh: :(( Anyway, the RSS feed option doesn't work for my present situation and email would be nice, if possible. Thanks.
-
pixel on photoyou think he caught that? :laugh:
-
datagridview filtering....where to start?Were you not getting exceptions after adding a couple of Force rows and then select a Torque row?
-
ComboBox selection generating list for another comboBox questionThanks for your help on this. I was able to become much more familiar with the event handlers. I began focusing on DataGridView FAQ Appendix A, 18 that you mentioned a bit ago. I was trying to get that going and was still having some issues and then came across http://social.msdn.microsoft.com/forums/en-US/winformsdatacontrols/thread/6f6c2632-afd7-4fe9-8bf3-c2c8c08d1a31/[^] Anyway, I'll have to tweak it a bit to keep users from pulling down the second comboBox first (which will throw and exception), but it's exactly what I need. Anyway, you taking the time really helped me out to understand some "basic" things that will help me get through the rest of this project. Thanks again.
public partial class Form1 : Form
{
DataTable tblPrimary, tblSecondary;
BindingSource primaryBS, filteredSecondaryBS, unfilteredSecondaryBS;public Form1() { tblPrimary = new DataTable("Primary"); tblPrimary.Columns.Add("ID", typeof(int)); tblPrimary.Columns.Add("Name", typeof(string)); tblSecondary = new DataTable("Secondary"); tblSecondary.Columns.Add("ID", typeof(int)); tblSecondary.Columns.Add("subID", typeof(int)); tblSecondary.Columns.Add("Name", typeof(string)); tblPrimary.Rows.Add(new object\[\] { 0, "Force" }); tblPrimary.Rows.Add(new object\[\] { 1, "Torque" }); tblPrimary.Rows.Add(new object\[\] { 2, "Pressure" }); tblSecondary.Rows.Add(new object\[\] { 0, 0, "lb" }); tblSecondary.Rows.Add(new object\[\] { 1, 0, "N" }); tblSecondary.Rows.Add(new object\[\] { 2, 0, "oz" }); tblSecondary.Rows.Add(new object\[\] { 3, 1, "in-lb" }); tblSecondary.Rows.Add(new object\[\] { 4, 1, "ft-lb" }); tblSecondary.Rows.Add(new object\[\] { 5, 1, "N-m" }); tblSecondary.Rows.Add(new object\[\] { 6, 2, "PSI" }); tblSecondary.Rows.Add(new object\[\] { 7, 2, "Pa" }); tblSecondary.Rows.Add(new object\[\] { 8, 2, "bar" }); InitializeComponent(); primaryBS = new BindingSource(); primaryBS.DataSource = tblPrimary;
-
datagridview filtering....where to start?from: http://social.msdn.microsoft.com/forums/en-US/winformsdatacontrols/thread/6f6c2632-afd7-4fe9-8bf3-c2c8c08d1a31/[^]
public partial class Form1 : Form
{
DataTable tblPrimary, tblSecondary;
BindingSource primaryBS, filteredSecondaryBS, unfilteredSecondaryBS;public Form1() { tblPrimary = new DataTable("Primary"); tblPrimary.Columns.Add("ID", typeof(int)); tblPrimary.Columns.Add("Name", typeof(string)); tblSecondary = new DataTable("Secondary"); tblSecondary.Columns.Add("ID", typeof(int)); tblSecondary.Columns.Add("subID", typeof(int)); tblSecondary.Columns.Add("Name", typeof(string)); tblPrimary.Rows.Add(new object\[\] { 0, "Force" }); tblPrimary.Rows.Add(new object\[\] { 1, "Torque" }); tblPrimary.Rows.Add(new object\[\] { 2, "Pressure" }); tblSecondary.Rows.Add(new object\[\] { 0, 0, "lb" }); tblSecondary.Rows.Add(new object\[\] { 1, 0, "N" }); tblSecondary.Rows.Add(new object\[\] { 2, 0, "oz" }); tblSecondary.Rows.Add(new object\[\] { 3, 1, "in-lb" }); tblSecondary.Rows.Add(new object\[\] { 4, 1, "ft-lb" }); tblSecondary.Rows.Add(new object\[\] { 5, 1, "N-m" }); tblSecondary.Rows.Add(new object\[\] { 6, 2, "PSI" }); tblSecondary.Rows.Add(new object\[\] { 7, 2, "Pa" }); tblSecondary.Rows.Add(new object\[\] { 8, 2, "bar" }); InitializeComponent(); primaryBS = new BindingSource(); primaryBS.DataSource = tblPrimary; primaryComboBoxColumn.DataSource = primaryBS; primaryComboBoxColumn.DisplayMember = "Name"; primaryComboBoxColumn.ValueMember = "ID"; // the ComboBox column is bound to the unfiltered DataView unfilteredSecondaryBS = new BindingSource(); DataView undv = new DataView(tblSecondary); unfilteredSecondaryBS.DataSource = undv; secondaryComboBoxColumn.DataSource = unfilteredSecondaryBS; secondaryComboBoxColumn.DisplayMember = "Name"; secondaryComboBoxColum
-
datagridview filtering....where to start?Apparently you took a look at the code I had in the previous post and said "enough is enough" or "I'll never be able to help that"?? :-D A couple of questions:
Stanciu Vlad wrote:
DataTable mainData = new DataTable("mainData"); mainData.Columns.Add("ID", typeof(int)); mainData.Columns.Add("ValueType", typeof(int)); mainData.Columns.Add("ValueUnitOfMeasurement", typeof(int)); mainData.Columns.Add("TheValue", typeof(decimal));
I can't see that this is doing anything accept providing a DataSource place marker for dataGridView1. In fact, all of the mainData.Columns.Add lines can be commented out without impacting the functionality. In either case, it doesn't take long to add different types of measurements (Force, Torque, or Pressure) to have it begin to throw exceptions. Would you concur with this? Thanks.
-
datagridview filtering....where to start?Stanciu Vlad wrote:
secondTableBindingSource.DataSource = tblSecondary;
This results in creating a table in the dataGridView that has i Rows + 1 (the +1 is the default row for the next entry), which are all blank. In this case it adds the 6 rows that correspond to 'tblSecondary.Rows.Add', but the rows added are blank. The first comboBox does allow you to drop down the three selections, but the row will remain blank. However, the filter will eliminate all rows except for a number of rows pertaining to the number of items in the filtered 'Units' column. But again they are blank, but you can at least select one and have it write to the cell. And last, but not least, selecting on the next row, 1st column comboBox throws an "Object reference not set to an instance of an object". Unless you see something obvious here and can prod me in that direction, I have spent way too much time on trying to get this to work and it probably makes sense to throw out what I've tried and start from scratch. I thought this was going to be a bit more straightforward, but alas...... X|
-
datagridview filtering....where to start?I have the following and I'm having a hard time getting the second comboBox column to hook up to the filtered datasource. As you can see, there are two comboBoxColumns in the dataGridView. Am I missing something obvious here? Thanks. (Also, I have tried linking it up in primaryCB_SelectedIndexChanged, without success, which is why there isn't any code there for that)
public void Form1_Load(object sender, EventArgs e)
{DataTable tblPrimary = dataSet1.Tables.Add("Primary"); tblPrimary.Columns.Add("Type"); tblPrimary.Rows.Add("Force"); tblPrimary.Rows.Add("Torque"); tblPrimary.Rows.Add("Pressure"); DataTable tblSecondary = dataSet1.Tables.Add("Secondary"); tblSecondary.Columns.Add("Primary\_Type"); tblSecondary.Columns.Add("Unit"); tblSecondary.Rows.Add("Force", "lb"); tblSecondary.Rows.Add("Force", "N"); tblSecondary.Rows.Add("Force", "oz"); tblSecondary.Rows.Add("Torque", "in-lb"); tblSecondary.Rows.Add("Torque", "oz-in"); tblSecondary.Rows.Add("Torque", "N-m"); dataGridView1.DataSource = tblSecondary; DataGridViewComboBoxColumn col = new DataGridViewComboBoxColumn(); col.DataSource = tblPrimary; col.ValueMember = "Type"; dataGridView1.Columns.Add(col); DataGridViewComboBoxColumn col2 = new DataGridViewComboBoxColumn(); col2.DataSource = tblSecondary; col2.ValueMember = "Unit"; dataGridView1.Columns.Add(col2); } private void primaryCB\_SelectedIndexChanged(object sender, EventArgs e) { if (dataGridView1.CurrentCell.ColumnIndex == 0) //allow control on only one column { ComboBox cb = sender as ComboBox; if (cb != null) { Debug.WriteLine(cb.SelectedValue + "TEST"); BindingSource bsSecondary = new BindingSource(); bsSecondary.DataSource = dataSet1.Tables\["tblSecondary"\]; string filter = string.Format("Primary\_Type = {0}", cb.SelectedValue); bsSecondary.Filter = filter; Debug.WriteLine(filter);
-
.TableName, why use that?PIEBALDconsult wrote:
Try it.
Yes, I knew this would be coming. One can certainly add a table to either a collection or use it in a method without having a formal name (but I don't think that is what you meant, is it)
public class Tables
{
public DataTable tblTest1;
public DataTable tblTest2;
public DataSet dsTables;public Tables() { dsTables = new DataSet(); tblTest1 = new DataTable(); tblTest2 = new DataTable(); dsTables.Tables.Add(tblTest1); dsTables.Tables.Add(tblTest2); } public void ShowTables() { DataTableCollection tables = this.dsTables.Tables; foreach (DataTable tbl in tables) Console.WriteLine(tables.IndexOf(tbl).ToString()); } } public static class Program { static int Main(string\[\] args) { Tables coll = new Tables(); coll.ShowTables(); Console.WriteLine(); Console.ReadLine(); return 0; } }
granted, having the foreach execute on
Console.WriteLine(tbl.TableName);
seems a bit more useful at first glance, so I guess I have my answer.........
-
.TableName, why use that?You can't do that with the variable?
-
.TableName, why use that?Hi all, I've been trying to determine a good reason why one would use .TableName when the name of the DataTable variable is required anyway and .TableName is optional. Seems that having spent 10 minutes googling, gave me good enough reason to post here what seems like should be an easy question to answer...... I'm assuming it is the same type of situation one would encounter using ProEngineer (CAD). One could name a part with its part name (which would be the file name) and also have an optional "common name". So you could have 012569.prt which has a common name of Bolt. However, in my opinion, have different nomenclature for the same item is usually a "state of confusion" waiting to happen. Thanks!
-
hiYou guys are terrible. :laugh: I think I will let him take my picture though. Now my dumb questions don't make me feel so bad.
-
datagridview filtering....where to start?Stanciu Vlad wrote:
apply a filter to your second comboBox (something like "Option1 = " + comboBox1.Text, but adapt it to a dataGridView).
I have the following filtering method:
private void GetRowsByFilter()
{
//DataTable table = DataSet1.Tables["Orders"];
//// Presuming the DataTable has a column named Date.
string expression;
expression = "MeasureType = 'Force'";
DataRow[] foundRows;// Use the Select method to find all rows matching the filter. foundRows = table.Select(expression); // Print column 0 of each returned row. for (int i = 0; i < foundRows.Length; i++) { Debug.WriteLine(foundRows\[i\]\[0\] + "test"); } }
I am calling this method in my comboBox SelectedIndexChanged. With that I do get the number of rows returned that matches Force in Debug.Writeline, but not sure how to filter the 2nd ComboBox display member. Do you have any thoughts on this?