Click here to Skip to main content
15,894,825 members
Home / Discussions / Visual Basic
   

Visual Basic

 
QuestionVB 2008 DataGridView Pin
Filippo197430-Mar-10 5:46
Filippo197430-Mar-10 5:46 
AnswerRe: VB 2008 DataGridView Pin
dan!sh 30-Mar-10 6:12
professional dan!sh 30-Mar-10 6:12 
AnswerRe: VB 2008 DataGridView Pin
Filippo197430-Mar-10 6:18
Filippo197430-Mar-10 6:18 
GeneralRe: VB 2008 DataGridView Pin
Filippo197430-Mar-10 10:12
Filippo197430-Mar-10 10:12 
GeneralRe: VB 2008 DataGridView Pin
Sebastian Br.31-Mar-10 21:37
Sebastian Br.31-Mar-10 21:37 
AnswerRe: VB 2008 DataGridView Pin
William Winner30-Mar-10 11:04
William Winner30-Mar-10 11:04 
AnswerRe: VB 2008 DataGridView Pin
William Winner30-Mar-10 11:08
William Winner30-Mar-10 11:08 
QuestionCreate autowidth() Property Pin
nyt197230-Mar-10 1:32
professionalnyt197230-Mar-10 1:32 
Hi dear!,

I am trying to create a ruler for my project. The ruler is from right to left. I want to add an autowidth propert, which should automatically set the width of ruler when the form is resized.

at design time it works but at run time it give me error.

Following is the Ruler's code and it give error when I add it to an application and run it.

Public Class nytRuler

    Private Sub nytRuler_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
        Dim g As Graphics = e.Graphics
        Dim p As Point = New Point(0, 0)
        Dim s As Size = New Size(Me.Width, Me.Height)
        Dim curRec As Rectangle = Me.ClientRectangle()

        g.DrawRectangle(Pens.Black, curRec)
        'Converting Pixels to Twips
        Dim dpmm As Single = g.DpiX / 25.4F
        Dim ptoTwip As Single = (curRec.Width * 15)
        'Twips to Inches
        Dim twipToInches As Single = CSng(ptoTwip / 1440)
        Dim b As Single = curRec.Width
        'Draw Numders 1 2 3 etc.
        For a As Single = 0 To twipToInches
            g.DrawString(a, New Font("Arial", 10), Brushes.Black, b, 10)
            b = b - 96 '288 192 96
        Next
        b = curRec.Width
        'Dim ptomm As Integer = Me.Width / dpmm
        'Draw Lines between inches, and long line every 5th
        Dim y As Single = 10.0F
        Dim z As Integer = 0
        For x As Single = b To 0 Step -9.6
            g.DrawLine(Pens.Black, x, 0, x, y)
            z += 1
            If z = 5 Then
                y = 15
                z = 0
            Else
                y = 10
            End If
        Next
    End Sub
    Private wd As Boolean

    Public Property autowidth() As Boolean
        Get
            Return wd
        End Get
        Set(ByVal value As Boolean)
            If value Then
                Me.Width = ParentForm.Width
            End If
            wd = value
            Me.Invalidate()
        End Set
    End Property
End Class

GeneralRe: Create autowidth() Property Pin
DaveAuld30-Mar-10 4:35
professionalDaveAuld30-Mar-10 4:35 
AnswerRe: Create autowidth() Property Pin
DaveAuld30-Mar-10 11:31
professionalDaveAuld30-Mar-10 11:31 
AnswerRe: Create autowidth() Property Pin
Anubhava Dimri30-Mar-10 20:07
Anubhava Dimri30-Mar-10 20:07 
AnswerRe: Create autowidth() Property Pin
nyt197230-Mar-10 20:27
professionalnyt197230-Mar-10 20:27 
GeneralRe: Create autowidth() Property Pin
nyt19721-Apr-10 0:51
professionalnyt19721-Apr-10 0:51 
GeneralRe: Create autowidth() Property Pin
nyt19724-Apr-10 19:30
professionalnyt19724-Apr-10 19:30 
QuestionVB.NET Date Functions Calculations [modified] - SOLVED Pin
Member 442053429-Mar-10 22:43
Member 442053429-Mar-10 22:43 
AnswerRe: VB.NET Date Functions Calculations Pin
Steven J Jowett29-Mar-10 22:52
Steven J Jowett29-Mar-10 22:52 
GeneralRe: VB.NET Date Functions Calculations Pin
Member 442053429-Mar-10 23:08
Member 442053429-Mar-10 23:08 
GeneralRe: VB.NET Date Functions Calculations Pin
Member 442053429-Mar-10 23:23
Member 442053429-Mar-10 23:23 
GeneralRe: VB.NET Date Functions Calculations Pin
Steven J Jowett29-Mar-10 23:42
Steven J Jowett29-Mar-10 23:42 
QuestionResize external application Pin
csanmba29-Mar-10 10:55
csanmba29-Mar-10 10:55 
AnswerRe: Resize external application Pin
Tarakeshwar Reddy29-Mar-10 12:15
professionalTarakeshwar Reddy29-Mar-10 12:15 
GeneralRe: Resize external application Pin
csanmba30-Mar-10 1:43
csanmba30-Mar-10 1:43 
QuestionOK Going Mad...VB.Net Mail Pin
Dalek Dave29-Mar-10 9:59
professionalDalek Dave29-Mar-10 9:59 
AnswerRe: OK Going Mad...VB.Net Mail Pin
nlarson1129-Mar-10 10:18
nlarson1129-Mar-10 10:18 
GeneralRe: OK Going Mad...VB.Net Mail Pin
Dalek Dave29-Mar-10 21:27
professionalDalek Dave29-Mar-10 21:27 

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.