Jump to content
Xtreme .Net Talk

mocella

Avatar/Signature
  • Posts

    278
  • Joined

  • Last visited

Everything posted by mocella

  1. If you turn on the XML Documentation File in a C# project (under Configuration Properties/Build/Outputs in Project Properties), you can generate a .CHM file via NDoc (free, open source utility). You use the "///" notation before all your functions, properties, etc in code to add "<summary>" tags then fill in the text yourself. This is what goes into the .XML file which NDoc will parse out to .CHM, or even a decent HTML site if so desired. http://ndoc.sourceforge.net/wiki/HomePage
  2. What you'd do is create and add another table to your dataset that has the same layout as your existing table (use Table.Clone() for this). Call it parentTable for my example. One you do that, you need to provide your "Distinct" keyed rows in the new table - you can write your own Select Distinct function for ADO.Net or check out MSDN.com for the sample there. Now that you have your "parent" rows, you simple add the datarelation to the dataset and finally set your column expression for the Quantity column. Call it myRelation in my example. Dim myRelation As New DataRelation("NewRelation", New DataColumn() {parentTable.PartColumn}, New DataColumn() {existingTable.PartColumn}) ds.Relations.Add(myRelation) parentTable.PartColumn.Expression = "Sum(Child(NewRelation).Quantity)"
  3. Actually, in C#, instead of addHandler/removeHandler, you use: controlInstance.SomeEvent += ..... controlInstance.SomeEvent -= ..... [/Code] but, you get the same functionality. Also, in my example, I don't think you can use AddHandler/RemoveHandler in my case - since the UI makes a reference to the Domain Logic project and the Domain Logic is trying to raise a specific event on the UI. It becomes a circular-reference and you won't compile if you try this, unless I missed something. This is the only way I got this process to work.
  4. For events that are fired/handled within the same class, I just use Event Handlers, since this seems to me the path of least resistence. Where I have used Delegates is when I want to "catch" events that are fired in another layer of my application. So, I have my "listener" in my UI project, and pass the address of this function into my constructor of my Domain Logic object. Later, something will happen in the Domain Logic that needs to "raise" some UI event, and this is where I just use that addressOf my delegate (that was passed by-reference) and fire off this UI function from within my Domain Logic. When I was deciding how to handle this, I had others just recommend a timer that kept looking at some property on the Domain Logic, but this Delegate function seemed to be a better solution.
  5. Or, just march this guy down to the DBA group and have him pitch "SELECT*" for all SELECT stored procedures and let the DBAs deal with him! :cool:
  6. Yes - use a DataRelation to do this.
  7. You need to define your datarelation to be based on an array of columns, instead of just one. Something like this (from a VB.Net project): Dim specificRel As New DataRelation("relationSample", New DataColumn() {TableA.Column1, TableA.Column2, TableA.Column3}, New DataColumn() {tableB.Column1, tableB.Column2, tableB.Column3})
  8. Try this: someNewDataset = someExistingDataSet.Copy();
  9. Look into some Sockets samples/MSDN Documentation.
  10. You'll have better luck if you create your own overload constructor and leave the IDE generated one alone (been there myself). Here's how it'd look: private Form _someFormInstanceHolder; public SomeClass( ) { // // Required for Windows Form Designer support // InitializeComponent(); } public SomeClass( Form someFormInstance ):this() { //store user struct in global variable _someFormInstanceHolder= someFormInstance ; }
  11. The short answer is just use the one you're more comfortable with (or the one your company says is the standard, as is my situation). Both sides have their good points, but here's some I've noticed in working both sides of the argument: C# only allows for one indexed property per class (see Indexers in MSDN). In VB.net, you can have as many as you want. Background compilation - VB.net has it, C# doesn't (so those darn blue-squiggly lines don't go away until you do another compile). C# doesn't do much implicit casting for you, which I think is a good thing as you really have to think your logic out and realize what it is you're doing. Now, before this thread gets crazy, I'll just head for cover... :cool:
  12. \w should do the trick - matches any "Word" character, including underscore - [a-zA-Z0-9_] the "opposite" is \W which matches any "non-Word" character outside of the above list
  13. We've had much better luck, and much less aggravation using UltraEdit to avoid these very problems.
  14. (no worries :) ) Actually, here's some vb.net registry code I used a while back: Private Function RegistryGetString(ByVal registryPath As String, ByVal keyName As String) As String Try Dim objKey As RegistryKey 'search HKEY_LOCAL_MACHINE subpaths: objKey = Registry.LocalMachine.OpenSubKey(registryPath ) Return Convert.ToString(objKey.GetValue(keyName , "")) Catch ex As Exception ErrorLog(ex) End Try End Function
  15. I was answering his second question about file access, not the registry question.
  16. True - but only as the default property for a class, so if you need more than one indexed property in this class, you're out of luck. But, if you just need one, you're good to go. I also went through this unfortunate discovery a while back, only to find another perk that vb.net gives you.
  17. Okay, then go with a common function to return you a datatable - your method signature should look like this: private function GetSomeData( byVal spName as String) as DataTable You need to use a dataadapter to fill your datatable - see MSDN. Once you get back from GetSomeData, you can assign your databindings like so (I'll assume your proc returns data in this format (ID, Description): DataTable myComboData = GetSomeData("dbo.GetComboData") cboSomeControl.DataSource = myComboData cboSomeControl.ValueMember = myCombo.Columns(0).ToString() 'ID cboSomeControl.DisplayMember = myCombo.Columns(1).ToString() 'Desc and so forth. I haven't actually tried this code (or any VB.net for that matter) in a while, so this may not be exact but you'll be on the right track.
  18. Can you explain your situation a bit more - are you creating an mdi application? Some more background will probably get you some better responses.
  19. One approach would be to have a function that takes your control and the select string (or stored proc name) and perhaps a paramter array as parameters for this function. You can then have this function call to a "GetDataReader" function that takes the select string/parm array from the other function above, and sets up and returns a data-reader. Now you can just populated your listbox/combobox or whatever. I'd probably set up a function for each type of control "FillComboBox"/"FillListBox" in the case that there were specific requirements for each specified control type, but you could probably work out a generic function in this case since the mentioned controls are "ListControls".
  20. Like PlausiblyDamp said, just create your own array of TextBoxes and add the appropriate members. It should look something like this Dim boxArray(4) as textbox boxArray(0) = someTextBoxControlInstance ... boxArray(4) = anotherTextBoxControlInstance Dim oTB as textbox For Each otb in boxArray ...do something with oTB.~~~ Next
  21. Try specifying "FileAccess.Read" to your Filestream. This is from MSDN: FileStream s2 = new FileStream(name, FileMode.Open, FileAccess.Read, FileShare.Read);
  22. Check out System.Web.Mail namespace. Do a search here, the syntax has been covered before.
  23. Right - I should have mentioned that - Nant just hooks into other utilities you have installed through the Framework SDK and any other (NDoc, NUnit, etc).
  24. Right, but you only need the SDK to run Nant, which is a bit more work than calling "devenv", but a heck of a lot more flexible in the longrun.
  25. I've got my builds automated using Nant, thereby using the C# command-line compiler in this sort of fashion. It's a damn nice utility - I have 5 projects in my solution and Nant fires through everything, runs my unit-tests (NDoc) and creates a .chm file (NDoc) at the end. Best of all, these utilities I use are all open-source/free.
×
×
  • Create New...