Click here to Skip to main content
15,907,687 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: How to bookmark the audio file content Pin
Dave Kreskowiak4-Nov-08 3:07
mveDave Kreskowiak4-Nov-08 3:07 
QuestionProblem in making a row disappear after button click Pin
susan_1516153-Nov-08 19:32
susan_1516153-Nov-08 19:32 
AnswerRe: Problem in making a row disappear after button click Pin
Dave Kreskowiak4-Nov-08 3:06
mveDave Kreskowiak4-Nov-08 3:06 
GeneralRe: Problem in making a row disappear after button click Pin
susan_1516154-Nov-08 18:01
susan_1516154-Nov-08 18:01 
GeneralRe: Problem in making a row disappear after button click Pin
susan_1516154-Nov-08 19:46
susan_1516154-Nov-08 19:46 
GeneralRe: Problem in making a row disappear after button click Pin
Dave Kreskowiak5-Nov-08 1:52
mveDave Kreskowiak5-Nov-08 1:52 
GeneralRe: Problem in making a row disappear after button click Pin
susan_1516155-Nov-08 4:25
susan_1516155-Nov-08 4:25 
QuestionPrinting a DataGrid Pin
Agelaus3-Nov-08 3:56
Agelaus3-Nov-08 3:56 
I have made it so i can see data when I do a print preview, but when I send it to the printer, It acts as though it looses all the rows since it only prints the header, and no data.

Private Sub Button1_Click(ByVal sender As System.Object,
                          ByVal e As System.EventArgs)
                          Handles Button1.Click

    Me.printResultsPreview.Document = Me.printResults
    Me.printResultsPreview.ShowDialog()
End Sub


Private Sub PrintDocument1_PrintPage(ByVal sender As System.Object,
         ByVal e As System.Drawing.Printing.PrintPageEventArgs)
         Handles printResults.PrintPage


    Dim currentTab As Integer          'Horizontal Posistion
    Dim currentLine As Integer         'Verticle Posistion
    Const ROW_HEIGHT As Integer = 15   'Line Height

    Dim totalRows As Integer           'Total number of rows in the data grid
        totalRows = Me.DataGridView1.Rows.Count
    Static currentRow As Integer       'Current row in the data grid
    Dim currentCell As Integer         'Current cell in the data grid

    Static pageCount As Integer = 1    'Counts Number of pages
    Static printedRows As Integer = 0  'Counts the number of rows per page

    Const MAX_ROWS As Integer = 33     'Maximumn number of rows on a page

    Dim x As Integer                   'For printing the Horizontal Lines


    'Reset Horz and Vert Posistion
        currentLine = 10
        currentTab = 25

    'Print the header
        e.Graphics.DrawString("| Last Update", New Font("Georgia", 10, FontStyle.Bold), Brushes.Black, currentTab, currentLine)
            currentTab += 150
        e.Graphics.DrawString("| Food Name", New Font("Georgia", 10, FontStyle.Bold), Brushes.Black, currentTab, currentLine)
            currentTab += 150
        e.Graphics.DrawString("| Food Group", New Font("Georgia", 10, FontStyle.Bold), Brushes.Black, currentTab, currentLine)
            currentTab += 150
        e.Graphics.DrawString("| Amount", New Font("Georgia", 10, FontStyle.Bold), Brushes.Black, currentTab, currentLine)
            currentTab += 150
        e.Graphics.DrawString("| Units", New Font("Georgia", 10, FontStyle.Bold), Brushes.Black, currentTab, currentLine)
            currentTab += 150

    'Move down one line, and reset Horz Posistion
        currentLine += ROW_HEIGHT
        currentTab = 25

    'Print Horizontal Line
        For x = 25 To 800
            e.Graphics.DrawString("-", New Font("Georgia", 10), Brushes.Black, x, currentLine)
        Next

    'Move down one line and reset Horz Posistion
        currentLine += ROW_HEIGHT
        currentTab = 25

        For printedRows = 0 To MAX_ROWS

            'Leave loop if you have reached the end of the data grid
                If (Me.DataGridView1.Rows(currentRow).Cells(1).Value = String.Empty) Then
                    Exit For
                End If
            'Print the data
                    For currentCell = 0 To 4
                        e.Graphics.DrawString("| " & Me.DataGridView1.Rows(currentRow).Cells(currentCell).Value, New Font("Georgia", 10), Brushes.Black, currentTab, currentLine)
                        currentTab += 150
                    Next

            'Move down one line
                currentLine += ROW_HEIGHT

            'Print Horizontal Lines
                For x = 25 To 800
                    e.Graphics.DrawString("-", New Font("Georgia", 10), Brushes.Black, x, currentLine)
                Next

            'Move down one line, change your current row, and reset Horz Posistion
                currentLine += ROW_HEIGHT
                currentTab = 25
                currentRow += 1
        Next


        'Print footer
            e.Graphics.DrawString(Now.ToString("M/dd/yyyy") & " - " & Now.ToShortTimeString(), New Font("Georgia", 10), Brushes.Black, 25, 1060)
            e.Graphics.DrawString("Page:" & pageCount, New Font("Georgia", 10), Brushes.Black, 750, 1060)

        'Check if your at the end of a page
            If (printedRows = MAX_ROWS + 1) Then
                e.HasMorePages = True
                pageCount += 1

            Else
                e.HasMorePages = False
            End If
End Sub

AnswerRe: Printing a DataGrid Pin
Duncan Edwards Jones3-Nov-08 21:14
professionalDuncan Edwards Jones3-Nov-08 21:14 
GeneralRe: Printing a DataGrid Pin
Agelaus4-Nov-08 4:25
Agelaus4-Nov-08 4:25 
Questionhow to ftp upload file from windows to unix server Pin
naveengopinath3-Nov-08 1:34
naveengopinath3-Nov-08 1:34 
AnswerRe: how to ftp upload file from windows to unix server Pin
Eddy Vluggen3-Nov-08 1:50
professionalEddy Vluggen3-Nov-08 1:50 
AnswerRe: how to ftp upload file from windows to unix server Pin
Dave Kreskowiak3-Nov-08 1:52
mveDave Kreskowiak3-Nov-08 1:52 
AnswerRe: how to ftp upload file from windows to unix server Pin
rprateek4-Nov-08 15:33
rprateek4-Nov-08 15:33 
QuestionFolder monitering Pin
jishbalan3-Nov-08 0:11
jishbalan3-Nov-08 0:11 
AnswerRe: Folder monitering Pin
Eddy Vluggen3-Nov-08 0:19
professionalEddy Vluggen3-Nov-08 0:19 
GeneralRe: Folder monitering Pin
jishbalan3-Nov-08 1:22
jishbalan3-Nov-08 1:22 
GeneralRe: Folder monitering Pin
Steven J Jowett3-Nov-08 1:28
Steven J Jowett3-Nov-08 1:28 
QuestionRe: Folder monitering Pin
Eddy Vluggen3-Nov-08 1:41
professionalEddy Vluggen3-Nov-08 1:41 
GeneralRe: Folder monitering Pin
Uros Calakovic3-Nov-08 10:40
Uros Calakovic3-Nov-08 10:40 
QuestionProxy error / get defaultproxy Pin
JR2122-Nov-08 21:19
JR2122-Nov-08 21:19 
QuestionDraw shape on the basis of some point Pin
sunil goyalG2-Nov-08 20:14
sunil goyalG2-Nov-08 20:14 
AnswerRe: Draw shape on the basis of some point Pin
dan!sh 2-Nov-08 22:59
professional dan!sh 2-Nov-08 22:59 
GeneralRe: Draw shape on the basis of some point Pin
sunil goyalG3-Nov-08 0:53
sunil goyalG3-Nov-08 0:53 
GeneralRe: Draw shape on the basis of some point Pin
dan!sh 3-Nov-08 7:31
professional dan!sh 3-Nov-08 7:31 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.