Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read

Sponsored Links



Functions for DutchTools module

Software Development


Reply
 
Thread Tools Search this Thread
  #1  
Old 26-07-2011
Member
 
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.

Reply With Quote
  #2  
Old 26-07-2011
Member
 
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
Reply With Quote
  #3  
Old 26-07-2011
Member
 
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
Reply With Quote
  #4  
Old 26-07-2011
Member
 
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
Reply With Quote
  #5  
Old 26-07-2011
Member
 
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
Reply With Quote
  #6  
Old 26-07-2011
Member
 
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
Reply With Quote
  #7  
Old 27-07-2011
Member
 
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
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Functions for DutchTools module"
Thread Thread Starter Forum Replies Last Post
Getting “Compile error in Hidden Module: AZ Wizard Module” in Word 2007 Wayne R Windows Software 7 11-01-2014 06:52 PM
error in Excel: "Compile error in hidden module: <module name>" aghuvi MS Office Support 5 08-10-2011 04:08 PM
Array Functions in PHP SuperXCM Software Development 2 26-03-2009 10:57 AM
Functions in PHP Gyan Guru Guides & Tutorials 3 13-12-2008 06:20 PM
Functions in Excel Stephanatic Windows Software 3 04-10-2008 12:40 PM


All times are GMT +5.5. The time now is 12:13 AM.