Click here to Skip to main content
15,562,222 members
Home / Discussions / Visual Basic
   

Visual Basic

 
QuestionVB 2008 DataGridView Pin
Filippo197430-Mar-10 6:46
Filippo197430-Mar-10 6:46 
AnswerRe: VB 2008 DataGridView Pin
dan!sh 30-Mar-10 7:12
professional dan!sh 30-Mar-10 7:12 
AnswerRe: VB 2008 DataGridView Pin
Filippo197430-Mar-10 7:18
Filippo197430-Mar-10 7:18 
GeneralRe: VB 2008 DataGridView Pin
Filippo197430-Mar-10 11:12
Filippo197430-Mar-10 11:12 
GeneralRe: VB 2008 DataGridView Pin
Sebastian Br.31-Mar-10 22:37
Sebastian Br.31-Mar-10 22:37 
AnswerRe: VB 2008 DataGridView Pin
William Winner30-Mar-10 12:04
William Winner30-Mar-10 12:04 
AnswerRe: VB 2008 DataGridView Pin
William Winner30-Mar-10 12:08
William Winner30-Mar-10 12:08 
QuestionCreate autowidth() Property Pin
nyt197230-Mar-10 2:32
professionalnyt197230-Mar-10 2: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 5:35
professionalDaveAuld30-Mar-10 5:35 
AnswerRe: Create autowidth() Property Pin
DaveAuld30-Mar-10 12:31
professionalDaveAuld30-Mar-10 12:31 
AnswerRe: Create autowidth() Property Pin
Anubhava Dimri30-Mar-10 21:07
Anubhava Dimri30-Mar-10 21:07 
AnswerRe: Create autowidth() Property Pin
nyt197230-Mar-10 21:27
professionalnyt197230-Mar-10 21:27 
GeneralRe: Create autowidth() Property Pin
nyt19721-Apr-10 1:51
professionalnyt19721-Apr-10 1:51 
GeneralRe: Create autowidth() Property Pin
nyt19724-Apr-10 20:30
professionalnyt19724-Apr-10 20:30 
QuestionVB.NET Date Functions Calculations [modified] - SOLVED Pin
Member 442053429-Mar-10 23:43
Member 442053429-Mar-10 23:43 
AnswerRe: VB.NET Date Functions Calculations Pin
Steven J Jowett29-Mar-10 23:52
Steven J Jowett29-Mar-10 23:52 
GeneralRe: VB.NET Date Functions Calculations Pin
Member 442053430-Mar-10 0:08
Member 442053430-Mar-10 0:08 
GeneralRe: VB.NET Date Functions Calculations Pin
Member 442053430-Mar-10 0:23
Member 442053430-Mar-10 0:23 
GeneralRe: VB.NET Date Functions Calculations Pin
Steven J Jowett30-Mar-10 0:42
Steven J Jowett30-Mar-10 0:42 
QuestionResize external application Pin
csanmba29-Mar-10 11:55
csanmba29-Mar-10 11:55 
AnswerRe: Resize external application Pin
Tarakeshwar Reddy29-Mar-10 13:15
professionalTarakeshwar Reddy29-Mar-10 13:15 
GeneralRe: Resize external application Pin
csanmba30-Mar-10 2:43
csanmba30-Mar-10 2:43 
QuestionOK Going Mad...VB.Net Mail Pin
Dalek Dave29-Mar-10 10:59
professionalDalek Dave29-Mar-10 10:59 
AnswerRe: OK Going Mad...VB.Net Mail Pin
nlarson1129-Mar-10 11:18
nlarson1129-Mar-10 11:18 
GeneralRe: OK Going Mad...VB.Net Mail Pin
Dalek Dave29-Mar-10 22:27
professionalDalek Dave29-Mar-10 22: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.