Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
S

SerialHobbyist

@SerialHobbyist
About
Posts
13
Topics
5
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Obtaining a reference to the TreeView item in a context menu
    S SerialHobbyist

    Thanks for your suggestion. I'm new to OO and I think I was just over-complicating things! Regards SH

    C# help question windows-admin

  • Obtaining a reference to the TreeView item in a context menu
    S SerialHobbyist

    I've created a TreeView which lists items from active directory. With the help of another Code Project user, I've created a context menu which is specific to the type of object right-clicked-on by the user. The problem is that when I select the menu option, the 'sender' holds a reference to the MenuItem, not the TreeNode clicked-on in the first place. How can I get a reference to the original TreeNode that the user right-clicked on? I've thought of one way but it seems a bit of a botch: to create a TaggedMenuItem class inherited from MenuItem which has a 'Tag' like Controls have and to use the MouseUp event and populate the Tag of EVERY TaggedMenuItem on the context menu with a reference to the TreeNode as I create the context menu. Then, I can get back to it from the menu item click event handler. Like I said, this sounds a bit crap. Is there a better way?

    C# help question windows-admin

  • Context Menu in TreeView control
    S SerialHobbyist

    Thanks very much. That sorted it out for me and I'm generating a context-specific menu.

    C# windows-admin tutorial question

  • Context Menu in TreeView control
    S SerialHobbyist

    I'm displaying a TreeView of an active directory domain. I want to right-click on a Node and display a context menu which has a submenu which is built depending on the type of object clicked on. I've created a context menu but when right-clicking on an object, this code, running in the Popup event of the context menu item which displays the sub-menu: MenuItem directoryObjectClickedOn = (MenuItem)sender; ContextMenu cm = directoryObjectClickedOn.GetContextMenu(); TreeView ad = (TreeView)cm.SourceControl; DirectoryEntry aDObject = (DirectoryEntry)ad.SelectedNode.Tag; MessageBox.Show(aDObject.Name); always gives me the previous object, not the current one. Any idea how to get the current object?

    C# windows-admin tutorial question

  • Microsoft.Win32 Namespace
    S SerialHobbyist

    I'm a newbie so maybe this is a daft question but why do you need to? If you just put

    Imports Microsoft.Win32

    at the top of your class, does that do the trick?

    Visual Basic question dotnet

  • How to cancel a form with a text box with the Leave Event coded
    S SerialHobbyist

    My New User form has a pair of text boxes used to define new users to my app. For both I've used the 'Leave' event to validate them before the form's OK button is enabled. (I've included the code for the simpler one of the two below.) I also want a Cancel button so that the user can choose not to set up a new user. At the mo, the Cancel button just sets DialogResult.Cancel. When the user clicks on the Cancel button the first time, the Leave event is still triggered and the users gets a "You must enter a name." message box. If the user clicks Cancel again, the window closes. I realise that I could do the checks when the user clicks OK but it seems 'more OO' to validate each box. How can I avoid this message box on cancel but still check the formatting when the user moves out of the text box otherwise?

    Private Sub txtNewOppName_Leave(ByVal sender As Object, _
    ByVal e As System.EventArgs) Handles txtNewOppName.Leave

    If txtNewOppName.Text = "" Then 
    Me.NameDefined = False
    MessageBox.Show("You must enter a name.")
    Me.Select()
    Else
    Me.NameDefined = True
    End If
    
    If Me.EmailDefined And Me.NameDefined Then
    Me.btnOk.Enabled = True
    End If
    

    End Sub

    Visual Basic question tutorial

  • how to code toolbar panels.
    S SerialHobbyist

    No, you could use If...End If. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vblr7/html/vastmSelectCase.asp I've assumed an Open button, a Save button and a SaveAs button. For the Open button, I've pointed it at what might be the routine you've already written to handle a traditional menu item called mnuFileOpen. Select Case toolbar.Buttons.IndexOf(e.button) Case 0 mnuFileOpen_Click(Nothing, Nothing) Case 1 SaveFile() Case 2 SaveFileAs() Case Else ' Other values. 'Since you should know how many buttons you've got, you shouldn't 'need a Case Else. End Select Don't forget that if you've used separators, they'll be on this list. E.g. If you have a separator after the Open button, you should code: Case 1 Case 2 SaveFile() etc.

    Visual Basic question tutorial

  • TextBox / RichTextBox - displaying the end
    S SerialHobbyist

    You star! Thanks very much.

    Visual Basic help question

  • how to code toolbar panels.
    S SerialHobbyist

    When you click on a toolbar, the toolbar's ButtonClick event is fired and the button that was click is passed in ToolBarButtonClickEventArgs - its button property contains the index of the button (from the Buttons collection). You could deal with it using a: Select Case yourToolBarName.Buttons.IndexOf (e.Button) for example.

    Visual Basic question tutorial

  • TextBox / RichTextBox - displaying the end
    S SerialHobbyist

    Hi I'm using a TextBox (or could use a RichTextBox) to display a file. I want it to default to showing the last few lines of the file, rather than the first. I've had a look at MSDN but I can't seem to find anything relevant. Can you help? SH

    Visual Basic help question

  • Royal Mail
    S SerialHobbyist

    But isn't a bit crap that the recipients don't take the trouble to put them through the right letter box?

    The Lounge announcement

  • Setting a form's location and size
    S SerialHobbyist

    Perfect. And by inserting the middle three lines into the Load event, and changing 'newForm' to 'Me', I've managed to change the main form as well. Don't worry about the saving - I've got that bit sorted out. Thanks for your help.

    Visual Basic question

  • Setting a form's location and size
    S SerialHobbyist

    Is it possible to set a form's location and size before displaying it? I have a couple of resizable forms in my current project. I'd like to have the app remember the size and location of the forms when the user last closed them.

    Visual Basic question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups