Jump to content
Xtreme .Net Talk

Nerseus

*Experts*
  • Posts

    2607
  • Joined

  • Last visited

Everything posted by Nerseus

  1. whew :) -nerseus
  2. Off-topic If MFC didn't kill C++, .NET surely won't :) -ner
  3. When you complete the calculations. -ner
  4. You can look at the AdapterDetails object to get at the Description property. Judging by the samples I've seen, this property may only be available for hardware devices. You can loop through the Manager.Adapters collection with something like: foreach (AdapterInformation ai in Manager.Adapters) { System.Diagnostics.Debug.WriteLine(ai.Information.Description); } The Adapters collection of the Manager object is static so it doesn't need to be instantiated. -nerseus
  5. It looks like you've got an extra underscore in your connection string. Try this instead: Dim strConnection As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\temp\db1.mdb" -nerseus
  6. Check out this link. -ner
  7. If you mean to hide columns (your second question), you have to define a new DataGridTableStyle. Check the help for more info. I believe you can also make columns non-editable this way but I'm not sure if there's an easier way. -nerseus
  8. I guess that pretty much sums up whether we've heard of them or not. :) But just because I've never heard of them doesn't mean they're not a good resource for learning .NET. I couldn't speak about their certification either but maybe they're more well known in England (I assume, from your reference to £). I wouldn't be too concerned with getting *any* certifications unless you know that you need to, for a particular job for instance. You can see another thread where I mention the MCAD/MCSD cert and my opinion on the role they play in getting a job and such (in general, experience is more important). -nerseus
  9. I'm not sure what you mean by "I should be able to go further in my .Net program after ending the VB6 program?". Your code will continue running after the line: p1.Start(); If you want your program to halt until the VB6 app terminates, you'll have to simulate the "halt" yourself (by disabling the form or something similar) or by using the Shell method. The line that hooks up the event handler (p1.Exited += new System...) won't halt at all. It's just hooking up the event so that when the process ends, it will call your function (OnProcessExited in my example). -ner
  10. D'oh! I meant fields. Sorry - you can define properties, just not fields. For example: public string Test; -nerseus
  11. Here ya go: First, define a new object type. This is useful if you want to store and ID and a description. If you just need a description you can skip this and just add items directly to an ArrayList (see below). Public Class LookupItem Private textData As String Private idData As Object Public Sub New() End Sub Public Sub New(ByVal textVal As String) Me.idData = 0 Me.textData = textVal End Sub Public Sub New(ByVal idVal As Object, ByVal textVal As String) Me.idData = idVal Me.textData = textVal End Sub Public ReadOnly Property ID() As Object Get Return idData End Get End Property Public ReadOnly Property Text() As String Get Return Me.textData End Get End Property Public Overrides Function ToString() As String Return Me.textData End Function End Class Next, change your binding code to this: Dim row As DataRow Dim al As ArrayList = New ArrayList() al.Add(New LookupItem(0, "Blank Value")) For Each row In commission_dataset.Tables("sales_rep_comm").Rows al.Add(New LookupItem(row(0), row(1))) Next ComboBox1.DataSource() = al ComboBox1.ValueMember = "ID" ComboBox1.DisplayMember = "Text" I hope this works, I'm not too good with VB (I'm a C# guy). The idea is to loop through each row of your DataTable and add the data as a new LookupItem object to an arraylist. Bind the combo to the arraylist instead of the DataTables view. Also, the line right before the For Each adds a dummy row. You may have to change that to use your own values. -ner
  12. Slow down, I just got in! I'll have to add something later :) -nerseus
  13. Whew - I would hope the sorting works :) I don't know about Access, but in SQL Server a primary key doesn't necessarily mean that a select on that table will come back in that order. The only ways I know of to guarantee a sort is to issue an ORDER BY or to define a clustered index (which doesn't have to be on the Primary Key column). You should *never* make assumptions about the ordering of data. Also, using a code-based sort should always work (a DataView with a sort, or a DataTable.Select command with a sort). Another bad SQL practice I see a lot is people assuming column orders on an INSERT (where they use "INSERT INTO table1 VALUES (...)". You should always specify the columns you want to insert, such as "INSERT INTO table1 (col1, col2) VALUES(...)". -nerseus
  14. For which technique, adding a row to a datatable or using an ArrayList of custom objects? -nerseus
  15. Since you're binding directly to the datatable you'll have to add a "dummy" row to your datatable. As an alternative, you can either build a special object and put it in an ArrayList and bind to that (ask if you want a sample) or create a new DataTable and copy the data from your sales_rep_comm table to the new DataTable. You can then add a row to the new DataTable. The first option, adding a row to your DataTable, may seem odd at first. But usually a DataTable used to fill a combo is just a lookup table - meaning your app won't be modifying the table in the DataSet (it's only used to populate a combo). Adding a row to a DataTable is easy, too. -nerseus
  16. Thanks for the VB conversion :) One note: I don't know about VB.NET, but interfaces can't implement properties in C#. -nerseus
  17. In addition to the resources above, I'll add that sometimes your task at hand will only allow you a DataSet or a DataReader. For instance, if you want to bind a datagrid you'll need a dataset. You could conceivably read in data through a datareader and populate some custom type, even a dataset built from the DataReader, but I would go with a DataSet. Also, if you want to databind and have simplified updates, you'll want a DataSet. A DataReader can only read in data - no updates. -nerseus
  18. How are you adding/updating right now? You can use a command on a DataSet to do "automatic" inserts/updates/deletes. Or, you can issue direction SQL statements such as "INSERT INTO Customers..." (or call a proc using either method). For searches, you'll need to write a query unless you just want to bring back all records for a table (not normally a good idea, but maybe). Can you post the code you have so far? -nerseus
  19. You have a couple of options... First, do you really want the parent to pass data to the child, or have the active child "pull" something from the parent? If you really want the parent form to pass data to the active child window, you'll need to somehow get a specific interface to the child. If you know that all of the child windows are of type Class2 for instance, you can cast the ActiveMdiChild property as Class2 and then call any public methods on that form: // From the parent form... ((Class2)this.ActiveMdiChild).SetSpecialData(this.myDataSet); You can also define an interface that all child forms inherit. As above, you can cast the child form as the interface to make the function call. For example: // Define the interface: public interface ISpecialForm { public void SetSpecialData(object data); } // In Class2, a child form: public class Class2 : System.Windows.Forms.Form, ISpecialForm { public void SetSpecialData(object data) { // Receive the data... } } // From within the MDIParent form: ((ISpecialForm)this.ActiveMdiChild).SetSpecialData(this.myDataSet); -ner
  20. I haven't seen any other option similar to the old D3DSWAPEFFECT_COPY_VSYNC. Just by playing around did I find the PresentInterval (which used to be reserved for FullScreen) and read up on the SwapEffect (some good info in the help for C# on this). -ner
  21. Assuming your sort is correct, I can't explain why the DataSet wouldn't bring them back in the right order... I'm curious to see what you find out. Is this an app and database that you could upload for us to try out? -nerseus
  22. I use a general rule of thumb of 250 or 500 records max (depending on the number of columns). Anything more than that and you'd be better off filtering or paging. You want to limit the records not only because it takes a lot of client resources, but a lot of server power, network traffic, etc. to send more records to the client. Some controls, notably the old VB6 Flexgrid, had trouble displaying too many records as well. Hopefully you won't have the need to ever bring back more than 500 records at once. A good app will provide some kind of filter, either through a search or some paging mechanism to limit the amount of data going across the line. If they *really* need more records, you may have to deal with downloading entire tables to a client and do the paging there. It's not as fun to code so I'd avoid it unless you have to. Was this a "what if" question, or something that has actually come up? -nerseus
  23. No problem :) If you want to learn how to bind a grid to a DataView (a filtered, sorted view of a DataTable) let me know. Ah heck, here it is... Assume you have two tables, Table1 and Table2, which both contain a key column named State. You want to show a list of cities from Table2 that match the state currently chosen from Table1 (which is bound to a listbox). string state = listBox1.Text; DataView dv = new DataView(ds.Tables["Table2"], "state = '" + state.Replace("'", "''") + "'", "Cityname", DataViewRowState.CurrentRows); dataGrid1.DataSource = dv; -Nerseus
  24. Use the following search in your .NET help (minus the double quotes): "walkthrough creating master detail windows" It should find a how-to titled "Walkthrough: Creating a Master-Detail Windows Form" which shows how to bind a ListBox and as you click entries, it automatically fills a filtered DataGrid. -nerseus
  25. If One, it's syncing up each refresh to the monitor's refresh. If your monitor is at 100hz, you can expect 50 FPS to be the max, give or take. If you had a really fast machine and graphics card, you might get closer to 100 FPS, but you wouldn't go faster than the refresh. By changing it to Immediate, you're saying don't wait for the monitor to refresh, flip the backbuffer immediately. I'd read up on the "tearing" effects that might get introduced using certain PresentIntervals and SwapEffects. Also, anything about 30FPS is generally considered acceptable though 60FPS or higher is ideal. 50 FPS shouldn't be a worry. I'd wait til you add some objects and other logic to your app's main loop then see what FPS you're getting. -nerseus
×
×
  • Create New...