
Drizzt109
Members-
Posts
23 -
Joined
-
Last visited
Content Type
Profiles
Forums
Blogs
Events
Articles
Resources
Downloads
Gallery
Everything posted by Drizzt109
-
Grids Doesn't seem like there's much out there in terms of grids for C#, yet....
-
maybe this will help? Thanks! private void Form1_Load(object sender, System.EventArgs e) { InitializeCombos(); t.Elapsed+=new System.Timers.ElapsedEventHandler(ChangeTextBox); t.AutoReset = true; t.Enabled = true; loadCSVFile(); CreateGrid(); AddStyle(); rt = new Realtick.RealtickClass(); rt.BalanceUpdate = 1; rt.TradeUpdate = 1; order = new Order(rt,this); MessageBox.Show (dt.Columns.Count.ToString()); } private void loadCSVFile() { try { string sConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\;Extended Properties = Text;"; OleDbConnection objConn; OleDbCommand objCmdSelect; OleDbDataAdapter objAdapter1; objConn = new OleDbConnection(sConnectionString); objConn.Open(); objCmdSelect = new OleDbCommand("SELECT * FROM test1.csv",objConn); objAdapter1 = new OleDbDataAdapter(); objAdapter1.SelectCommand = objCmdSelect; objAdapter1.Fill(ds); objConn.Close(); } catch(Exception e) { Console.Write(e.Message); } } public void CreateGrid() { dataGrid1.DataSource = ds.Tables[0].DefaultView; dt = ds.Tables.Add("MyTable"); aColStr[0] = "Ticket ID"; aColStr[1] = "Symbol"; aColStr[2] = "Side"; //dt.Columns.Add(aColStr[0].ToString(),typeof(string)); //dt.Columns.Add(aColStr[1].ToString(), typeof(string)); //dt.Columns.Add(aColStr[2].ToString(),typeof(string)); //dt.Columns.Add("Volume", typeof(short)); //dt.Columns.Add("Route", typeof(string)); //dt.Columns.Add("Status",typeof(string)); } public void AddStyle() { DataGridTableStyle dgTableStyle = new DataGridTableStyle(); dgTableStyle.MappingName = dt.TableName;//its table name of dataset DataGridTextBoxColumn symbolCol = new DataGridTextBoxColumn(); symbolCol.MappingName = aColStr[0]; symbolCol.HeaderText = "SYMBOL"; symbolCol.Width = 200; dgTableStyle.GridColumnStyles.Add(symbolCol); dataGrid1.TableStyles.Add(dgTableStyle); GridColumnStylesCollection colStyle; colStyle = dataGrid1.TableStyle[0].GridColumnStyles; //colStyle[0].Width = 100; //colStyle[1].Width = 100; //colStyle[2].Width = 100; //datagridTextBox = new DataGridTextBoxColumn(dataGrid1.TableStyles[0].GridColumnStyles[0]); }
-
once I run my SQL query and load the data table, it says there are no columns in the Columns collection, even though I can see data in the grid. How is this possible? dt.Columns.Count.ToString() returns 0. So there's no way for me to bind a DataGridColumnStyle to any particlular column...
-
I'm using a csv file as my data source, which works great except that the first line of the csv file becomes the column headers in the datagrid. Because the user will not be putting headers into the csv file itself, is there a way to pre-set these? Thanks in advance for any advice.
-
Thank You That worked, hallelujah. Thanks so much.
-
thanks, that works in VB.NET but not in C# for some reason...
-
thanks, i pass the form as a form type in the constructor, but i still don't have access to any of the objects on the form. If it is referencing my form then it should give me access to the textboxes etc. on the form.
-
Has anyone noticed the DataGrid freeze when explicitly adding rows to it ebyond the viewable area. I try to scroll down and my form crashes. Here's the way i'm adding the rows: public void UpdateGrid() { row = dt.NewRow(); row["Ticket ID"] = order.OrderRow; row["Symbol"] = order.sSymbol; row["BuySell"] = order.sBuySell; row["Volume"] = order.lVol; row["Route"] = order.sRoute; dt.Rows.Add(row); }
-
Code Ok, but I guess the wierd thing is how C# uses memory. Does it copy things or point. It will point to a form object (such as a datagrid), but copies entire forms? Does this make sense, because that seems to be what's happening. I set a form object to the form I pass in, but it doesn't have any of the objects in the form (textboxes, datagrid, etc.), which seems like its making a copy or is an entirely new form. I'm not sure which. private void Form1_Load(object sender, System.EventArgs e) { InitializeCombos(); t.Elapsed+=new System.Timers.ElapsedEventHandler(ChangeTextBox); t.AutoReset = true; t.Enabled = true; CreateGrid(); rt = new Realtick.RealtickClass(); rt.BalanceUpdate = 1; rt.TradeUpdate = 1; order = new Order(rt, this); } using System; using System.Windows.Forms; using Realtick; using REALTICKXLib; namespace TryWithTimer2 { /// <summary> /// Summary description for OrderEntry. /// </summary> public class Order { private string saccount; private string sbuysell; private string ssymbol; private int lvol; private int ishowvol; private string sroute; private double dprice; private Realtick.Realtick rt; static int iRow; private Form form; public Order(Realtick.Realtick RealT, Form Display) { rt = RealT; form = Display; rt.OnNewTradeEx +=new IRealTickEvent_OnNewTradeExEventHandler(rt_OnNewTradeEx); } public string sAccount { get { return saccount; } set { saccount = value; } } public int OrderRow { get { return iRow; } } public string sBuySell { get { return sbuysell; } set { sbuysell = value; } } public string sSymbol { get { return ssymbol; } set { ssymbol = value; } } public int lVol { get { return lvol; } set { lvol = value; } } public int iShowVol { get { return ishowvol; } set { ishowvol = value; } } public double dPrice { get { return dprice; } set { dprice = value; } } public string sRoute { get { return sroute; } set { sroute = value; } } } } } }
-
note One thing i noticed, when i update the grid using that property, it freezes the program when the cells are beyond the viewable area. I wonder what could cause this?
-
does this work for C#? I've tried passing the whole form (which cotnains the main method) into another class so that it can manipulate the form, but can't get that to work. Any ideas?
-
Yup, thanks.
-
DataGrids actually i don't see that property in the DataGrid object...
-
thank you!
-
How do i change an existing cell in a DataGrid from one value to another value? The DataGrid control seems not ot have any Set methods...
-
thanks guys!
-
One mroe thing... Ahh, wait, now i see where you can download his source code...
-
One thing... This looks like EXACTLY what I need, but one question if you have used this code. What is the datagridtextBox object. He never declares this and without knowing how to create it i can't add the combBox control. Thanks in advance.
-
Is there a way to have one column in a DataGrid display a combo box in each new row? I have a list of stocks and I'd like the DataGrid to contain a combo box with a "BUY" item and a "SELL" item for each row. Is this possible?
-
i have a user form that contains the main method. the user form has a text box that i'd like to update with the system clock every second. I do this from another class, but inside that class i can't get it to recognize the userform's textbox... in vb you just type something like: Form1.textBox1.Text = "Signal Time = " + e.SignalTime.ToString(); in C# you can declare the form as a static but then it's not updatng the same instance of the textbox? So how do I get around this? I now this is a very basic question, but I'm trying to learn C# and broaden my horizons, thanks for help in advance.
-
thanks for the discussion, even if you guys didnt agree!
-
What is the equivalent in C# to declaring an object variable WithEvents in VB.Net?