Jump to content
Xtreme .Net Talk

GT500Shlby

Members
  • Posts

    13
  • Joined

  • Last visited

About GT500Shlby

  • Birthday January 8

Personal Information

  • Occupation
    Lab Automation and Data Integration programmer
  • Visual Studio .NET Version
    Visual Studio .NET Enterprise
  • .NET Preferred Language
    VB.NET

GT500Shlby's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. Okay I was misunderstanding what you wanted. If someRegValue = 0 Then Dim you as new frmSomeForm you.show() ElseIf someRegValue = 1 Then someicon.visible = True End If This is all I can think of. If its a taskbar icon I never used those, and don't know how to show/hide it. but the form part works.
  2. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcn7/html/vatskreadingwritingtoregistryusingvisualbasic.asp That may help you. Its the msdn library article on reading and writing the Windows Registry. I also have some sample code I derived from that. Dim regConfig As RegistryKey regConfig = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Merck\\MRL LADI\\WPPDR", True) If regConfig Is Nothing Then Registry.LocalMachine.CreateSubKey("SOFTWARE\\Merck\\MRL LADI\\WPPDR") regConfig.CreateSubKey("Config") GoTo nofile End If strConfigFile = regConfig.GetValue("Config") NoFile: With OpenFileDialog1 .InitialDirectory = "..\Config" .Filter = "PD Rating Configuration (*.ini)|*.ini" .ShowDialog() strConfigFile = .FileName() End With regConfig.SetValue("Config", strConfigFile)
  3. With the launch of Visual Studio.Net and the changes in Visual Basic mostly, is there a change in the etiquette and "proper coding practices" itself? I was reading a forum and it listed a coding 'no-no' for Visual Basic that has came through the ages and latest releases as never using 'End' to end your program. Then I thought to myself, "Well, what are we supposed to do?" I guess my question is -- Is there a single resource for this new era of coding practices? Is it even formed yet? The .Net architecture is still an infant, even in this rapid pace world. Is this the medium to even start such a task to develop the "expert opinion" when it comes to the best way to do things. I come from a long history of asm, C, and C++ programming. I have ingrained into my psyche the proper coding elements that separated the puppies from the Big Dogs. Now I find myself out of school, in a job and I'm programming Visual Basic.Net and I try to use these old school style practices and sometimes I end up making more trouble than I sought to avoid. In the end it comes down to the particular coder and their way of doing things; Case in point using "select" or a switch statement over an If-then. Even for a mundane yes/no test. People will argue both ways, some will even concede. But I want to avoid the bad no-no's of VB.Net. Instead of just killing my program, I want to specifically free up all my memory used and terminate it correctly, I want to purge the memory I used and no-longer need in the middle of my program to avoid leaks. Flush the input and output streams, dot every 'i' and semi-colon every command (err, oh wait this is VB :D ). This is more of theory than stone cold syntax. What do you think? Any references? If there isn't one, should there be?
  4. Perfect! Thank you very much.
  5. I've searched everywhere for this and cannot find a correct answer. Background: I have 2 forms: 'Form1' as the main form 'InkPad' as a secondary form I launched InkPad by: Dim you as new InkPad you.show() Now I am using a Tablet PC and it has the Ink recognition defined my Microsoft.Ink. In the form InkPad, I have a groupbox which is selected as the Ink object so I can write in it. When I click a button called "translate" I want it to recognize the ink and change it to plain text and put it in a rich text box inside Form1 called 'rtxtComments'. Problem: It's not working correctly. Here is what I have: Private Sub cmdTranslate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdTranslate.Click If 0 = myRecognizers.Count Then MessageBox.Show("There are no handwriting recognizers installed. You need to have at least one in order to run this sample.") Else Dim objCont As Form1 objCont.rtxtComments.SelectedText = myInkCollector.Ink.Strokes.ToString If Not myInkCollector.CollectingInk Then myInkCollector.Ink.DeleteStrokes(myInkCollector.Ink.Strokes) gbInkPad.Refresh() End If End If End Sub Now the Ink Recognition itself works. But it won't put the recognized text into the rich text box. Anyone have any ideas?
  6. That's perfect! Thanks.
  7. I am designing an automated form in VB.NET. On windows XP, I want to generate a memory exception to test how the program will handle it. Also, I wan't to have the program run under extreme memory circumstances and see if it generates an exception. Is this possible at all?
  8. Very True. Thats why I wanted to have the external error handler. I really do not wan't to handle the errors inside the programs code, except for a few safety checks. My main goal is to not really display errors, but either automatically fix them or alert the user to help in fixing them. I'm new to VB.NET, I had tinkered with VB6, but I was mostly a C++ person. However I was "pushed" into this project.
  9. Okay, I got it. Thanks for your help. And I guess VB.NET doesn't have a way to call a GoTo function and then return to the exact line right after where you called the Goto. It probably is not needed, but would be a lazy way to use GoTo instead of writing functions.
  10. Well I don't want to really display the error, my main goal is to warn them the file doesn't exist then popup the openfiledialog to look for the file. But my main question was the proper usage of the GoTo. But I think I have found a way around that. Actually to add to my question; how would I query the Windows Registry for a file name and keep the config file location there, and if it doesnt exist or the registry entry doesnt exist to pop-up the open file dialog and then find the file and create or modify the registry entry?
  11. That's probably a matter of personal preference. I don't belive there is much of a difference when it gets translated to assembly.
  12. so like: try 'some code goes here catch someError as Exception 'do soemthing else end try But within the catch how would I test to see if the file exists or not, it seperates the catch and try's so a variale in try it not defined in the catch. I have my filestream like this: Dim fs2 As New FileStream(strConfigFile, FileMode.OpenOrCreate, FileAccess.Read) Dim tr As TextReader = New StreamReader(fs2) Dim kmfdm As String I like having the Error handler seperate from the rest of the function. I really just want to know if I can call a Goto and then return exactly the next line after the goto. Without havign to define a billion labels because it is in an if-then statement, so the return position would be different every time.
  13. I am having a problem with an ErrorHandler With the Goto and Resumes. I want to call a Goto and then resume where I left off. Public Function errHandler(ByVal intErrFlag As Integer, Optional ByVal strErrString As String = "") As Integer Dim strErrorMessage As String Dim msgbxStyle As MessageBoxOptions Dim strErrorTitle As String Dim response As MsgBoxResult Select Case intErrFlag Case 1 strErrorMessage = "Configuration and Data Files not found! Would you like to browse for them?" msgbxStyle = MsgBoxStyle.YesNo strErrorTitle = "Config File Error..." GoTo showbox Resume If response = MsgBoxResult.Yes Then With OpenFileDialog1 .InitialDirectory = strConfigFile .Filter = "PD Rating Configuration (*.ini)|*.ini" .ShowDialog() strConfigFile = .FileName() End With Return 1 Else strErrorMessage = "Cannot Recover from errors... Quitting." msgbxStyle = MsgBoxStyle.OKOnly strErrorTitle = "Quitting..." End End If Exit Function Case 2 strErrorMessage = "File Read Error: " & strErrString msgbxStyle = MsgBoxStyle.OKOnly strErrorTitle = "Error Reading File..." GoTo showbox Resume writErrorLog(2, strErrorMessage) Err.Clear() Exit Function Case 3 strErrorMessage = "File Write Error: " & strErrString msgbxStyle = MsgBoxStyle.OKOnly strErrorTitle = "Error Writing File..." GoTo showbox Resume writErrorLog(2, strErrorMessage) Err.Clear() Exit Function End Select Exit Function showbox: Beep() response = MsgBox(strErrorMessage, msgbxStyle, strErrorTitle) 'Resume Next End Function
×
×
  • Create New...