Jump to content
Xtreme .Net Talk

donaldc104

Avatar/Signature
  • Posts

    33
  • Joined

  • Last visited

About donaldc104

  • Birthday March 9

Personal Information

  • .NET Preferred Language
    VB.NET

donaldc104's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. You have to set up for column independence at item-add time. Example: itemNew.SubItems.Add("item1") itemNew.SubItems.Add("item2") itemNew.UseItemStyleForSubItems = False ' Cell independence... lvwTest.Items.AddRange(New ListViewItem() {itemNew}) Hey, I finally stumped the moderators on one! Do I get a badge or something? .
  2. SOLUTION: I change the color of individual cells in a List View control. I highlight cells in pink to show errors. lvwStats.Items(iIndex).SubItems(3).BackColor = Color.LightPink Normally my ListView is all white, with scattered cells highlighted in pink.
  3. This is easier to read. A lighter blue background.
  4. The dark blue background used by DotNetForums makes the black text hard to read. I suggest a lighter shade of blue.
  5. Problem fixed - the reference is named "Microsoft Scripting Runtime". It was buried in a very long list of items starting with Microsoft.
  6. I don't have "Microsoft Windows Scripting Runtime" in my list of components. Is it a special add-on?
  7. The HDD number should be good enough - thanks! But how do I reference Microsoft Windows Scripting Runtime ?
  8. Can the framework read the MAC address from Ethernet card? Or any other machine-specific data?
  9. This works great - thanks ! This works great ! Thank you very much, Divil ! Just one small typo: "Tab" not "Tag" NG: TabControl1.SelectedTag = TabPage1 OK: TabControl1.SelectedTab = TabPage1 I searched high and low and couldn't find this. But it's so obvious after you spell it out.
  10. Is there a way to "mouse-click a tab" on the top of a TabControl from code? I've tried several tactics but can't make it work yet.
  11. How can I read the machine-specific ID code (CPU serial number) ? Is there a disk-specific ID code on each hard disk? Are these functions supported by the framework or VB.NET? What are the common or technical names for these ID-codes?
  12. I'm having trouble catching a Timeout Exception. I can catch it generically with "Catch exc As Exception" and then identify it by its hash code, but this seems like a hack. I've searched the docs and tried many experiments but can't find the "right" way to catch it. This is a serial port read timeout. Can anyone help? Here's my code. Try ' Flush the COMM buffer: Read until no more chars: timeout. While (m_CommPort.Read(1) <> -1) ' LOOP: Poll & read. iChars += Chr(m_CommPort.InputStream(0)) ' Read any residue chars. iCharCount += 1 ' Count residue chars. lblEmStatus.Text = "Flushed " & iCharCount & ",=<" & iChars & ">" ' Display residue chars. End While ' A TimeOut exception here means "flush is completed, port is clear".-------------- 'Catch exc As System.IO.IOTimeoutException '---THIS WONT COMPILE: NOT DEFINED.-- 'Catch exc As System.Runtime.InteropServices.IOTimeoutException '---THIS WONT COMPILE: NOT DEFINED.-- 'Catch exc As System.IO.StringReader.IOTimeoutException '---THIS WONT COMPILE: NOT DEFINED.-- Catch exc As System.IO.IOException '---THIS COMPILES BUT NEVER CATCHES ANY EXCEPTIONS.-- MsgBox("System.IO.IOException") Catch exc As ServiceProcess.TimeoutException '---THIS COMPILES BUT NEVER CATCHES ANY EXCEPTIONS.-- MsgBox("ServiceProcess.TimeoutException") Catch exc As Exception ' THIS CATCHES ALL EXCEPTIONS OK. Dim ExceptionType As System.Type ExceptionType = exc.GetType() strErrMsg = exc.Message.ToString ' Text Error Message. iHashCode = exc.Message.GetHashCode MsgBox("Generic Exception " & iHashCode & "=<" & strErrMsg & ">") ' ' codes= -11889027343=NotOpen, +1218191172=Timeout End Try Where can I look up these mysterious codes ? They are not valid HRESULTS. I need to find out the Exception Types that correspond to these codes.
  13. I don't see any answer in using GetType. In both my test cases, exc.GetType() yielded NO distinguishing info. It says only "System.ApplicationException" I need to discriminate between TimeOuts and NON TimeOuts. The only way I see to do this is through exc.Message.GetHashCode. (or its even clumsier sibling exc.Message.ToString) Is there something here that I'm missing? :confused:
  14. Good suggestion (thanks!) but no luck. HashCode is still the only known method to make my program work. I tested two error cases: 1. Port Not Open and 2. Timeout. The only way to tell the difference between them is HashCode. Here's the code I used: Catch exc As Exception Dim ExceptionType As System.Type ExceptionType = exc.GetType() ' Error GetType strErrMsg = exc.Message.ToString ' Text Error Message. iHashCode = exc.Message.GetHashCode ' Error HashCode Console.WriteLine("TEST1 GT=" & exc.GetType().ToString() _ & ", H=" & iHashCode & ", M=" & strErrMsg) Here are the outputs from the two tests: TEST1 GT=System.ApplicationException, H=-108330557, M=Please initialize and open port before using this method TEST1 GT=System.ApplicationException, H=-1549478346, M=Read Error: Timeout error I tested on two different machines, both Win2000 but different configurations. Identical results. The HashCode numbers are constant, so this seems reliable. Maybe this will remain one of those unanswered questions.
×
×
  • Create New...