Jump to content
Xtreme .Net Talk

PlausiblyDamp

Administrators
  • Posts

    7016
  • Joined

  • Last visited

Everything posted by PlausiblyDamp

  1. Personally I have found the built in grid can quickly become a stumbling block when a more customised UI is required - the feature may be doable but often looks substandard or takes far more effort than the end result seems to justify. Depending on how badly this feature is required it may be worth investing in a 3rd party grid control that will give you far more control. A couple I have had previous experience with are http://www.infragistics.com/dotnet/netadvantage/winforms/wingrid.aspx#Overview and http://www.componentone.com/SuperProducts/FlexGridWinForms/ both of which have free evaluation versions.
  2. You could always use the datareader's IsDbNull function to check for nulls before attempting to assign the value, or if you are using .Net 2 or higher then the sqlTime variable could be defined as a nullable datetime. DateTime sqlTime; // m_db.Open; using (SqlCommand cmd = new SqlCommand("SELECT GetDate AS [CurrentDateTime]")) { SqlDataReader r = cmd.ExecuteReader(); while (r.Read() == true) { if (!r.IsDBNull(0)) sqlTime = (DateTime)r["CurrentDateTime"]; } } or DateTime? sqlTime; // m_db.Open; using (SqlCommand cmd = new SqlCommand("SELECT GetDate AS [CurrentDateTime]")) { SqlDataReader r = cmd.ExecuteReader(); while (r.Read() == true) { sqlTime = (DateTime)r["CurrentDateTime"]; } }
  3. I tend to use the first version when all classes in a file are part of the same namespace - it is less typing and easier to read. If I have more than one namespace in a single file (not common and I don't think I've ever had more than one namespace plus a single nested namespace) then the second form can sometimes be more readable.
  4. You might be better avoiding pictureboxes, and just use GDI / GDI+ to render the sprites. http://www.xtremedotnettalk.com/showthread.php?t=72746 http://www.xtremedotnettalk.com/showthread.php?t=90455 might be worth a glance as they cover similar issues.
  5. Have you tried just using the SendInput API? http://www.pinvoke.net/search.aspx?search=sendinput&namespace=[All] might be of some use.
  6. Visual Source Safe only ships with certain versions of visual studio and isn't free. Personally I'm not a big fan of VSS anyway... If you are after a free product I would stongly recomend you look at subversion (http://subversion.tigris.org/) - http://www.visualsvn.com/server/ is a simple way to get the server up and running. My prefered client is TortoiseSVN also a free download.
  7. It might be worth investigating https://winqual.microsoft.com - if you register (IIRC free but you do need a verisign certificate), you can access the crash dumps directly. Not sure if there is any way to redirect them automatically.
  8. You could open the file using a filestream and seek to a couple of k from the end, then open a streamreader on top of the filestream and read from there.
  9. If you load the xml into an XmlDocument then XPath can be used to locate the node e.g. XmlDocument doc = new XmlDocument(); doc.Load("XMLFile1.xml"); XmlElement ele = (XmlElement) doc.SelectSingleNode("//Stores/Division[@Name='A']"); Another possibility is XMLSerialization - either way they avoid the overheads of datasets / datatables.
  10. Something like the following should work...] If Date.Parse(.Text) > Date.Parse(.Text) Then 'error End If
  11. Never used it personally but IIRC Remedy does have a COM interface you can use for automation - that would probably be an easier method.
  12. It really depends on exactly what you are doing in regards to performance. Personally I would tend towards generic collections simply because of the improved functionality they offer and the more OO way of dealing with things they provide.
  13. http://msdn.microsoft.com/en-us/library/system.web.hosting.virtualpathprovider.aspx is probably your best starting point.
  14. If the files are being served over http then the sever will always be interpretting them as http requests - that is the purpose of the files being hosted on the server. Do you know if the server does support other methods of access or is http the only one?
  15. You could just check to see if the .Value is nothing, trying to convert the value to a string will fail if the value is null.
  16. Have you tried using a DataView? These allow you to filter or sort a datatable without having to requery the database.
  17. mm is for minutes, MM is for months ;) Also you might find thisdate.ToShortDateString will do the same (and will return the string correctly for the current locale). In your code the .ToString isn't needed as Format() returns a string anyway.
  18. The problem is down to the fact the selected text doesn't have a single font - at a guess you might have to loop over every character and set it's font individually...
  19. You could check each character using the Char.IsLetterOr Digit function, or a regular expression match could be used If Regex.Match(PasswordTextBoxX.Text, "^[a-zA-Z0-9]+$").Captures.Count > 0 Then 'is alphanumeric End If
  20. It does initially seem a bit more work, however in the long run WPF does provide a lot more functionality for you if you implement dependency properties. e.g. A designer using Expression could attach an animation that is triggered by your property changing or an animation could modify your property on completion...
  21. What code are you using to release Excel?
  22. When you say it 'doesn't work' what does happen?
  23. You would have to read through the file a line at a time and check each line for the keyword in question. Alternatively you could read the entire file into memory and split it into an array of strings then loop over the array looking for the keyword.
  24. Off the top of my head the closest literal translation of your code would be [highlight=sql] SELECT DISTINCT A.Status, A.ModelNum, B.ModelName FROM TableA A JOIN TableB B ON A.ModelNum = B.ModelNum WHERE A.Station = 'Testing' AND A.Employee IN (SELECT Employee FROM TableA WHERE Station = 'Building') AND A.TestDay BETWEEN Date1 AND Date2 [/highlight]
  25. Are you looking to do a one way databinding? i.e. just displaying information or also allowing updates to be sent back?
×
×
  • Create New...