Jump to content
Xtreme .Net Talk

Diesel

Avatar/Signature
  • Posts

    682
  • Joined

  • Last visited

Everything posted by Diesel

  1. Ok, I've decided that what Im doing is bad design anyway. I'll just stick with what I have. Thank you for your time.
  2. Override the mouse down event, set a flag (ex. mouseDown = true) Override the mouse up event, set the flag to false Override the mousemove event, check for the mouseDown flag and change the location of the panel relative to the mouse movement. You might want to change the cursor when it is over a moveable panel or give the panel a border if it is not distinct on the form.
  3. And I'd like to know why I can't access the thread <rant> started by Joe Mamma.
  4. Just clicked on Forum Leaders on the bottom of the home page. Realized I have never seen half these people post. Most haven't posted in the last year. Some of the administrators have less than 10 posts. Someone should kick them off.
  5. Did anything change in the dataset from the previous time you emitted the Xml?
  6. You should define your schema as an xml document <?xml version="1.0" encoding="utf-8" ?> <xs:schema targetNamespace="toffee" elementFormDefault="qualified" xmlns="toffee" xmlns:xs="http://www.w3.org/2001/XMLSchema"> .... </xs:schema> To associate the schema with a namespace: <?xml version="1.0" encoding="utf-8" ?> <t:userfile xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:t="toffee" xsi:schemaLocation="toffee Toffee.xsd"> .... </t:userfile> Either way, you always have to prefix tags to define which namespace they are from
  7. 1. When you stop the processing of the application, the paint event does not fire. 2. Intellisense works fine for me in the command window.
  8. public class Class1 { private int member; public int Member { get { return this.member; } set { this.member =value; } } }//end class public class Class2 { private int externalClassMember; public int ExternalClassMember { get { return this.externalClassMember; } set { this.externalClassMember = value; } } public void SetMember(ref int member) { this.externalClassMember = member; } } //end class public class Test { Class1 testClass1 = new Class1(); Class2 testClass2 = new Class2(); testClass1.Member = 10; testClass2.SetMember(ref testClass1.Member); testClass2.ExternalClassMember = 8; Console.WriteLine(testClass1.Member.ToString()); } [/Code] I want the property in class2 to point to the property in class1. Problem is, I get an error that properties cannot be passed as a ref parameter.
  9. 1. Create a event for each property and catch the event in the form Public Class Customer Public Event propertyChanged As EventHandler Private _name As String Public Property Name() As String Get Return Me._name End Get Set(ByVal Value As String) Me._name = Value RaiseEvent propertyChanged(Me._name, New EventArgs) End Set End Property End Class In Form: Private MyCustomer As Customer Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Me.MyCustomer = New Customer AddHandler Me.MyCustomer.propertyChanged, AddressOf CustomerChanged End Sub Private Sub CustomerChanged(ByVal sender As Object, ByVal e As EventArgs) Me.customername.Text = sender.ToString() End Sub 2. Create an Event Argument class that passes the name of the field modified, catch the event in the form and enumerate the property modified Public Delegate Sub ChangedEventHandler(ByVal sender As Object, ByVal e As CustomerEventArgs) Public Class Customer Public Event propertyChanged As ChangedEventHandler Private _name As String Public Property Name() As String Get Return Me._name End Get Set(ByVal Value As String) Me._name = Value RaiseEvent propertyChanged(Me._name, New CustomerEventArgs("Name")) End Set End Property End Class Public Class CustomerEventArgs Inherits EventArgs Private _customerField As String Public Property CustomerField() As String Get Return Me._customerField End Get Set(ByVal Value As String) Me._customerField = Value End Set End Property Public Sub New(ByVal field As String) Me._customerField = field End Sub In Form: 'Form_Load is same as previous Private Sub CustomerChanged(ByVal sender As Object, ByVal e As CustomerEventArgs) Select Case (e.CustomerField.ToLower()) Case "name" : Me.customername.Text = sender.ToString() End Select End Sub
  10. using System.Data; using System.Data.OleDb; DataSet DS; OleDbDataAdapter MyCommand; OleDbConnection MyConnection; MyConnection = new OleDbConnection("provider=Microsoft.Jet.OLEDB.4.0; data source=C:\myData.XLS; Extended Properties=Excel 8.0;"); // Select the data from Sheet1 of the workbook. MyCommand = new System.Data.OleDb.OleDbDataAdapter("select * from [sheet1$]", MyConnection); DS = new DataSet(); MyCommand.Fill(DS); MyConnection.Close();
  11. Class Diagrams using UML. Lots of UML books on amazon.
  12. Are you looking for the code itself or a process? One process would be to create a datatable with the exact columns of the excel sheet. Read each column from the excel sheet and add the data to the appropriate column. Bind the datatable to the datagrid.
  13. As long as you have 2 DateTime objects, the DateTime class has an overloaded subtraction operator that retruns a TimeSpan object. Therefore to get the time difference: DateTime start = DateTime.Now; DateTime end = DateTime.Now.AddHours(3); TimeSpan elapsed = end - start; MessageBox.Show("Days: " + elapsed.Days.ToString() + " Hours: " + elapsed.Hours.ToString() + " Minutes: " + elapsed.Minutes.ToString() ); [/Code]
  14. Nailed it. Yeh, the google code jam contest is pretty cool...but I'm assuming most people entering have a library of problems that they reference during the contest. My library is only about a dozen problems right now, so I'll be working on raw coding power. So I'm expecting to get my *** handed to me.
  15. Btw, has anyone entered the google code jam contest?
  16. There are 2 pieces of rope. The length and width of the two pieces are not neccessarily the same. Both pieces are inconsistent in width (ex. the middle may be thicker than the ends). Each piece of rope take exactly 1 hour to burn. By burning both pieces of rope, how do you measure 45 minutes of time? Hint: Since the ropes are of inconsistent width, burning half of a rope does not mean that 1/2 hour has passed.
  17. Actually Bob, given this environment you are correct. But take a look out in the real world and you'll find you are in the majority. Most of the CS students at my college are taking the major either for it's monetary benefits or because they like playing computer games. Funny enough, the dropout rate for CS at my school is higher than any other major, and most that fail CS move into a telecommunications major.
  18. Depending on the database server, you could use stored procedures. Also, you should encrypt the password (SHA1 is a nice algorithm), and possibly salt it (create a random value that is used to encrypt and save it in the database). When checking the password, simply encrypt the given answer (don't forget the salt) and check against the database field. If you want more info, I have an example of sha1 encryption at work...Just tell me. Also, Joe Mamma, what was meant about built sql? I assumed it meant that the sql was actually included within the code? As opposed to in the database server?
  19. Backtracking from what to what?
  20. 5 years old, huh? Sounds like a good time to start teaching him some Qbasic!
  21. Oh sorry... protected int someMember; public int SomeMember { get; set; }
  22. In the article mhildner posted (http://www.developerfusion.co.uk/show/4341/7/), where did the author get the < 16 bytes range from? Structures are best suited for... "smaller data value types under 16 bytes - structures like numbers crunching" No background evidence given for the < 16 bytes. I think he made it up.
  23. :) If Plausibly uses it, it's good enough for me. Besides... private int someMember; public int SomeMember { get; set; } isn't CLS Compliant.
  24. What do you use to identity member variables?
  25. Public Class Printer Private Shared _instance As Printer Public Shared ReadOnly Property Instance() As Printer Get If _instance Is Nothing Then _instance = New Printer End If Return _instance End Get End Property Public Enum Status As Integer Printing = 0 Waiting Unknown End Enum Public Function Printing(ByVal oDocument As Object) As Boolean ' Code to print object Return False End Function End Class clsPrinter? eww. M$ recommends leaving off prefixes these days, since you can easily find out the type during debug by mousing over.
×
×
  • Create New...