Results 1 to 4 of 4

Thread: Tooltip box with contents from a data table in Visual Basic

  1. #1
    Join Date
    Jun 2009
    Posts
    230

    Tooltip box with contents from a data table in Visual Basic

    The tip shows how to create, for example, on the cell of a DataGridView with specialized content a tooltip whose content in turn from the field of a data table is read. I often had in a data-bound DataGridView in case that is shown in a column a short cut. In explaining the tips I suppose it was this example: The DGV column contains the ISO abbreviation for the European currencies. The tooltip for this column is always for this text so there is a data table that contains both-both ISO currency code as well as text dt.

    Then you reach the "purpose" with the following procedure:

    Code:
      Private Sub DatagridView1_CellMouseEnter (ByVal sender As Object, _
       ByVal e As DataGridViewCellEventArgs) _
       Handles dataGridView1. CellMouseEnter
    
       Dim dgv As DataGridView = CType (sender, DataGridView)
    
       E. If RowIndex <= 0 Then Exit Sub
       E. If columnIndex <0 OrElse e. columnIndex> getDGVColsVisible (dataGridView1) Then Exit Sub
    
       Dim s As String = dgv. Columns (e. columnIndex). Name
       If n <> "Waehrungssymbol" Then Exit Sub
    
       Dim c As DataGridView dgv = cell. Rows (e. RowIndex). Cells (e. columnIndex)
    
       With c
         If Not IsDBNull (. Value) Then
           Dim As String = CVAL. Value
           bsWaehr. Position = bsWaehr. Find ("ISOKz" CVAL)
           Dim dd As DataRowView = bsWaehr. Current
    
           . ToolTipText = dd ("dtWaehrungstext)
         End If
       End With
     End Sub
    It is tested on which column of the DGV is the mouse and whether the DGV column for which the tooltip is to be produced, including one to the visible (there are the auxiliary function getDGVColsVisible, see below).

    In the example, the column "Waehrungssymbol" the ISO code, which in turn is stored in the data table under field ISOKz. The text to be shown as a tooltip is stored in field dtWaehrungstext. By means of the Binding Source "bsWaehr" is searched each row that contains the code in the current cell in the DGV. Then simply read only from the corresponding record for the German currency, the value assigned to the text and tooltip.

  2. #2
    Join Date
    Apr 2008
    Posts
    392

    Re: Tooltip box with contents from a data table in Visual Basic

    First, a few basic comments on splash screens. They are intended not only to present the program started, they can also take still some functions. First, you know certain shareware programs that provide registration information when starting, sometimes with time loops. Second, they often serve as the "entertainer" when loading large applications (eg Office applications, or even VB itself). The principle is simple: while is loading the main application (which can be heard especially on the hard drive noise is first of schonmal displays a splash screen so the user is schonmal reassured that there is doing what. Although our sample program is so small that the charging time will hardly play a role, we want to guide during the display schonmal loading the main application in the paths.

  3. #3
    Join Date
    Apr 2008
    Posts
    392

    Re: Tooltip box with contents from a data table in Visual Basic

    For this we first create a main form of time: In the top toolbar, the second Icon from the left adds a new form. Alternatively we can also project window context menu "Add / Add> New form / new form," or the main menu Project> Add Form. We give it the name "general form", will choose a nice background color, under caption "Mathe-Max", and besides, our form is of course also get an icon (which is later used as a symbol of our executable program). We click in the Icon field and select - just as when the image in our Splash Screen Image Control - for a suitable icon. We also see the icon top left of the title bar.

    We also add an image or a control. We call it "ball" and download at this time Picture a small icon, a red ball. We could load it as a BMP, an icon has the advantage that the round ball fits seamlessly into our background, as the transparency property can be used by Icons. That should be enough for now of elements times. Now we go into the code window of our first splash screen and select in the drop-down menu at the top left "Form". Immediately appear in the main window frame for the Form Load event (the default event for Forms):
    Code:
         Private Sub Form_Load ()
    
         End Sub
    We complement it with two commands:
    Code:
         Private Sub Form_Load ()
             Splashscreen.Show
             Load main form
         End Sub
    The first line causes the splash screen is displayed immediately after loading, before the next command, loading the main form or other preparatory commands are executed. We can replace Splashscreen.Show by a general notation:
    Code:
         Me.Show
    "Me" refers to the current form. In "Show" is a so-called "method". These are functions that are initiated by the program up and running. Other methods include:
    • Print - Print / Write
    • Move - Move
    • Hide - Hide
    • Drag - drag the mouse
    • Refresh - Refresh
    • Cls - Clear

  4. #4
    Join Date
    Feb 2011
    Posts
    40

    Re: Tooltip box with contents from a data table in Visual Basic

    Public Class Form1
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    ' Comment these lines out to use the ToolTip valeus set at design time.
    ttHint.SetToolTip(txtFirstName, "First Name Field")
    ttHint.SetToolTip(txtLastName, "Last Name Field")
    ttHint.SetToolTip(txtStreet, "Street")
    ttHint.SetToolTip(txtCity, "City")
    ttHint.SetToolTip(cboState, "State")
    ttHint.SetToolTip(txtZip, "ZIP")
    End Sub
    End Class

Similar Threads

  1. Table of Contents in Word 2010
    By DHR in forum Windows Software
    Replies: 1
    Last Post: 09-05-2012, 11:13 AM
  2. Data Validation in Visual Basic 6.0
    By Aidan 12 in forum Software Development
    Replies: 5
    Last Post: 04-03-2011, 05:25 AM
  3. What are data types and identifiers in Visual basic?
    By fLUTE in forum Software Development
    Replies: 4
    Last Post: 03-01-2011, 10:55 PM
  4. How to copy one table data into another table directly?
    By ComPaCt in forum Software Development
    Replies: 3
    Last Post: 22-09-2009, 03:54 PM
  5. Visual Basic 2005 or Visual Basic 6
    By Aasha in forum Software Development
    Replies: 5
    Last Post: 15-01-2009, 06:56 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,714,030,973.18488 seconds with 17 queries