Results 1 to 7 of 7

Thread: Functions for DutchTools module

  1. #1
    Join Date
    Jun 2011
    Posts
    72

    Functions for DutchTools module

    Lately I have been occupied again with "Modules" and "(sub) Classes" for the majority of people to utilize, they will be unhindered and open root if not made without anyone else's input! I'm making a Module called "DutchTools" it has a few capacities that can accommodate greenhorn's and progressed users further bolstering increase a good fortune in customizing with RB. For now I'll inquire programmers, depending on if you are able to impart then please offer to help others! The "DutchTools" module could at the end of the day be truly helpful and get some classes with late works for others to utilize. For now i have found a few capacities presented by some users.

  2. #2
    Join Date
    May 2009
    Posts
    511

    Re: Functions for DutchTools module

    Below code I use whenever I need to match up to the output of the MD5 of RB () with stored in hexadecimal MD5 which is the most common representation, but I remember it is not my original work:


    Code:
    Function StringToHex(src as string, separator as string) As string
      dim n, L, v as integer
      dim s as string
      L = LenB(src)
      for n=1 to L
        v = AscB(MidB(src, n, 1))
        s = s + RightB("00"+Hex(v),2)+separator
      next
      return LeftB(s, LenB(s)-LenB(separator))
    End Function

  3. #3
    Join Date
    May 2009
    Posts
    543

    Re: Functions for DutchTools module

    Just add the new function; it will help to you to place a window on the Bottom-Right of the users screen. Or center screen (NEW)

    Usage: (if you have a window called "Window1" then use this )

    Code:
    WindowToBottomRight( Window1 )
    WindowToCenter( Window1 )
    Code:
    Window1.WindowToBottomRight
    Window1.WindowToCenter

  4. #4
    Join Date
    May 2009
    Posts
    529

    Re: Functions for DutchTools module

    According to me I suggest you to add the below code. This function is in Visual Foxpro

    Code:
     '---  FINDS THE NUMBER OF OCCURENCES OF A STRING WITHIN ANOTHER STRING
      '---  USES THE NATIVE INSTR() FUNCTION 
      '---  CASE INSENSITIVE
      '---
      '---  Syntax:  if Occurs(cSearchFor As String,cSearchWithin As String) > 0 then
    
      dim x as Integer = 0
      dim nStart As Integer = 1
      dim nFound as Integer = 0
      
      while nStart < len(cSearchWithin)
        x = instr(nStart,cSearchWithin, cSearchFor)
        if x > 0 then
          nFound = nFound + 1
          nStart = x + 1
        Else
          Exit
        end
      wend
      
      Return nFound

  5. #5
    Join Date
    Apr 2009
    Posts
    569

    Re: Functions for DutchTools module

    I edited an example of the usual "MessageDialog" which will be very useful and can help you add a individual touch to their message boards, for example, you can give a title, set icon, the details, the message and so on. You can not do this with a MsgBox.
    Code:
    // This function defines a custom Message dialog template which you
    // can use through your whole program. Make sure you define this function
    // as global.
    // Use :
    // strResult = ShowMSG (Dialog_Title As String, Caption_Action As String, Caption_Alternative_Action As String, Caption_Cancel As String,
    //    Message As String, Explanation As String)
    // Resulting value : string value (pressed button caption is returned)
    
    // Define Custom MessageDialog
    
    Dim msgDialog As MessageDialog // Declere your basic MessageDialog
    Dim btnAction As MessageDialogButton // This is the dialog button
    Dim strResult As String
    msgDialog = New MessageDialog // Instantiate your own MessageDialog
    
    // Here we start to define your MessageDialog objects
    
    msgDialog.Title = strTitle // Title of the MessageDialog

  6. #6
    Join Date
    May 2009
    Posts
    539

    Re: Functions for DutchTools module

    I edited a method that saves a lot of writing when using the Messagebox through its program. It is best to put this method into a module and give a global reach.

    This is the Method definition :

    Method name :
    ShowMSG

    Parameters :
    strTitle As String, strAction As String, strAltAction As String, strCancel As String, strMSG As String, strExplain As String, intIcon As Integer
    Select Case intIcon
    Code:
    Case MessageDialog.GraphicNote, MessageDialog.GraphicCaution, MessageDialog.GraphicStop, MessageDialog.GraphicQuestion
    msgDialog.Icon = intIcon // Note icon onto the MessageDialog
    Case Else
    msgDialog.Icon = MessageDialog.GraphicNone
    End select
    
    // Which buttons to display ?
    If Len(Trim(strAction)) > 0 Then
    msgDialog.ActionButton.Caption = strAction
    Else
    msgDialog.ActionButton.Visible = False
    End If
    If Len(Trim(strAltAction)) > 0 Then
    msgDialog.AlternateActionButton.Caption = strAltAction
    msgDialog.AlternateActionButton.Visible = True
    Else
    msgDialog.AlternateActionButton.Visible = False
    End If
    If Len(Trim(strCancel)) > 0 Then
    msgDialog.CancelButton.Caption = strCancel
    msgDialog.CancelButton.Visible = True
    Else
    msgDialog.CancelButton.Visible = False
    End If

  7. #7
    Join Date
    May 2009
    Posts
    637

    Re: Functions for DutchTools module

    Here below using syntax we will call a method from the "app" class. Put the following code into the "Open" event of the "app" class:

    Code:
    Dim strValue As String
    Dim strTitle As String = "Mickey his weather forecast"
    Dim strAction As String = "Good"
    Dim strAlternativeAction As String = "Not good"
    Dim strCancel As String = "Cancel"
    Dim strMessage As String = "How is the weather at your place?"
    Dim strExplanation As String = "This dialog ask you about your local weather,"
     + EndOfLine +_
    "please be honest about it" + EndOfLine +_
    "Thank you!"
    Dim intIcon As Integer = MessageDialog.GraphicQuestion
    
    strValue = ShowMSG (strTitle, strAction, strAlternativeAction, 
    strCancel, strMessage, strExplanation, intIcon)
    
    // Showing result
    MsgBox strValue

Similar Threads

  1. Replies: 7
    Last Post: 11-01-2014, 06:52 PM
  2. Replies: 5
    Last Post: 08-10-2011, 04:08 PM
  3. Array Functions in PHP
    By SuperXCM in forum Software Development
    Replies: 2
    Last Post: 26-03-2009, 10:57 AM
  4. Functions in PHP
    By Gyan Guru in forum Guides & Tutorials
    Replies: 3
    Last Post: 13-12-2008, 06:20 PM
  5. Functions in Excel
    By Stephanatic in forum Windows Software
    Replies: 3
    Last Post: 04-10-2008, 12:40 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,502,482.19457 seconds with 17 queries