Jump to content
Xtreme .Net Talk

micropathic

Avatar/Signature
  • Posts

    77
  • Joined

  • Last visited

Everything posted by micropathic

  1. Thanks that's exactly what I was looking for!
  2. How can I subtract one string from another in vb .net? For instance: if I have the string: "C:\Windows\Subdir1\Subdir2\Subdir3" and another string like: "C:\Windows\Subdir1" How can I return the remaining text "\Subdir2\Subdir3" Thanks in advance for any help!
  3. Yeah, I noticed the comment, but I just don't understand why it doesn't work as any other function does. Is it because this is not something that can be changed on the fly or is it that this code is configured to only work in that manner?
  4. Actually I didn't. Why would that make a difference? Thanks, micropathic
  5. This code is supposed to disable the "X" (close) on a windows form: Private Declare Function RemoveMenu Lib "user32" (ByVal hMenu As IntPtr, ByVal nPosition As Integer, ByVal wFlags As Long) As IntPtr Private Declare Function GetSystemMenu Lib "user32" (ByVal hWnd As IntPtr, ByVal bRevert As Boolean) As IntPtr Private Declare Function GetMenuItemCount Lib "user32" (ByVal hMenu As IntPtr) As Integer Private Declare Function DrawMenuBar Lib "user32" (ByVal hwnd As IntPtr) As Boolean ' Private Const MF_BYPOSITION = &H400 Private Const MF_REMOVE = &H1000 Private Const MF_DISABLED = &H2 ' Public Sub DisableCloseButton(ByVal hwnd As IntPtr) Dim hMenu As IntPtr Dim menuItemCount As Integer ' 'Obtain the handle to the form's system menu hMenu = GetSystemMenu(hwnd, False) ' 'Obtain the number of items in the menu menuItemCount = GetMenuItemCount(hMenu) ' 'Remove the system menu Close menu item. 'The menu item is 0-based, so the last 'item on the menu is menuItemCount - 1 Call RemoveMenu(hMenu, menuItemCount - 1, _ MF_DISABLED Or MF_BYPOSITION) ' 'Remove the system menu separator line Call RemoveMenu(hMenu, menuItemCount - 2, _ MF_DISABLED Or MF_BYPOSITION) ' 'Force a redraw of the menu. This 'refreshes the titlebar, dimming the X Call DrawMenuBar(hwnd) End Sub ' ' '------------------- USAGE ------------------- 'Put this in the Load Event of a Form ' DisableCloseButton(Me.Handle) This code doesn't seem to work for me though because it says that a declaration was expected when I put my cursor over the DisableCloseButton(Me.Handle) which by the way is underlined with the blue "squigly" underline that vb.net uses to show something is wrong. If someone could let me know what the flaw could be I would be greatly appreciative. Thanks
  6. Thanks to both of you for your help! I was able to make it work using a combination of the code the code you provided: Function FoundMatch() As Boolean Dim s As String For Each s In ListBox1.Items If Not ListBox2.Items.IndexOf(s) = -1 Then '/// if it's also indexed in listbox2 ListBox2.Items.RemoveAt(ListBox2.Items.IndexOf(s)) End If Next End Function
  7. Compare Strings in Two Listboxes Ok, here's my situation: I have 2 listboxes that I am trying to compare the contents of. So, for eachline in listbox2, I need to see if the that line is also in listbox1. The code in a function I have tried to write so far is not working and I don't understand exactly why. Function FoundMatch() As Boolean Dim j, i As Integer For j = 0 To ListBox2.Items.Count - 1 For i = 0 To ListBox1.Items.Count - 1 If ListBox1.Items.Item(i) = ListBox2.Items.Item(j) Then ' Return True MsgBox("match") Else End If Next i Next j End Function Can anyone help me understand what I am doing wrong? Thanks in advance!
  8. Oops.. I see it now. Thanks for your help
  9. Bucky would you happen to have a link to that utility, I couln't find after searching on google. Thanks!
  10. Is there any type of add-on or utility for vs .net that will allow you to comment out blocks of code at a time? For instance in the SMS Installer utility there is a feature which allows you to highlight a block of code, right click and choose comment and it will comment out that entire block. It seems very convenient and makes it easier to work w/ code imho.
  11. Thank you both for your help, I got it working now! Thanks
  12. Actually, I need a way to do it manually because I am working with a windows ce device and am getting paths from it like "\storage card\directory\file.txt" and am eventually going to compare the file with a corresponding file from the pc like "c:\blah\whatever\file.txt". What I am doing is loading the value of a directory from the pc and a directory from the windows ce device into their own listboxes and plan to write some code that compares the contents of the two list boxes. But, before I can start comparing them, I need the contents of the listboxes to have a similar naming convention. In this case just the file and extension is what I'm planning on using. I've messed around with it using the instr() function, but just can't get it right. Do you know of a way to do this manually? Thanks for your help!
  13. How can I get the text to the right of the last backslash ("\") in a file name. For instance I would want to get the "test.txt" from the string "C:\Program Files\My App\My Dir\My Dir2\test.txt" or "test2.txt" from the string "C:\Program Files\My App\My Dir\test2.txt" TIA
  14. Thanks, your help is much appreciated!
  15. What would be the syntax to use to fill an array using the readline method?
  16. It doesn't matter which line it is on for my purposes. What matters is if the name of the file in text file 1 exists at all in text file 2. Thanks
  17. How can I load the contents of a text file into an array and compare it with the contents of another text file? For instance, if I have a text file with a listing of all the files in a directory with on file listed on each line of the text file, how can I read line by line from that text file to see if another text file contains the file listed in each line? For instance, if my directory listing in text file 1 looks like this: C:\3dlogo.gif C:\654-7303 Window Guy.txt C:\AUTOEXEC.BAT C:\boot.ini C:\BOXBOY.NES C:\capture.avi C:\cedb.dll C:\command.com C:\CONFIG.SYS C:\Ctp.log C:\devbld.pkg C:\devcpu.pkg How can I look in text file 2 to see if the text "C:\3dlogo.gif" exists and then see if the text "C:\654-7303 Window Guy.txt" exists, and so on. Thanks for any help in advance!
  18. Thanks, I really appreciate your help
  19. Thanks, I think that will help me get started. Would you by any chance know how to perform simple read/write operations to a database? Thanks!
  20. I'm very new to working with data in .net and am trying to find a way to load the file names and modified dates in a given directory into an .mdb Does anyone know how I can implement this sort of thing? Thanks in advance for any help!
  21. That sounds like a good idea. I was not aware you could do that in .net. Thanks!
  22. Hi, If my vb .net app is running and I want to kill the process by sending a command to it, how can I do that? For instance if I can start the program w/ a switch like: myapp.exe /start is there a way to kill the app by sending a switch to it? Basically what I'm trying to do his have my program run automatically when a user connects their Win CE device to the PC. That part I have figured out because the computer automatically detects when the device has been connected and it runs a registry key (auto_start_on_connect), so, when I enter the command line "myapp.exe /start" in that registry key, it fires that command. There is a similar registry key that fires as soon as the phone is disconnected called "auto_start_on_disconnect", but if I enter something like "myapp.exe /killit", it starts a whole other instance of my app and only passes the command to that instance. How can I make it so the appliction instance already runnning receives a command to kill itself, without starting another instance of the app? Thanks in advance for any help!
  23. Probably should have searched a little more before posting, but if anyone needs to know how I solved this issue, look here http://www.xtremedotnettalk.com/showthread.php?s=&threadid=79780&highlight=instance
  24. Hi, I have a project that has a text box on form1. The textbox.text needs to be changed after I select an item on another form. How do I do this without defining a new instance of form1. For instance, here is an example of the code I have on the second form that is supposed to change the text on form1: Form1.DefInstance.txtSPVpath.Text = Me.txtSphonePath.Text So how would I be able to acheive this without defining an instance of Form1, because as it is when the code above is executed, another form1 pops up, so there are now 2 instances of Form1. Is there a way to get around this? Thank you for any help
  25. Thanks for your help, and yes I am trying to determine whether the button was clicked, but more specifically the event caused by calling the "sync.click" sub. I had thought about doing that, and haven't really tried it yet, but let me ask you this if I did this: Public Sub Sync_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Sync.Click dim Syncing as boolean Syncing = true '****This part contains the part of the code that performs some needed steps for my program**** Syncing = False End Sub Would the code wait until the "'****This part contains the part of the code that performs some needed steps for my program****" portion of the code completes until setting the variable syncing to false or does that logic not really work?
×
×
  • Create New...