Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 731115
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T06:59:22+00:00 2026-05-14T06:59:22+00:00

I have a question regarding the some data which is being transfered from one

  • 0

I have a question regarding the some data which is being transfered from one form to my class. It’s not going quite the way i’d like to , so I figured maybe there is someone who could help me.

This is my code in my class

Public Class DrawableTextBox
  Inherits Drawable
  Dim i_testString As Integer

Private s_InsertLabel As String

Private drawFont As Font


Public Sub New(ByVal fore_color As Color, ByVal fill_color As Color, Optional ByVal line_width As Integer = 0, Optional ByVal new_x1 As Integer = 0, Optional ByVal new_y1 As Integer = 0, Optional ByVal new_x2 As Integer = 1, Optional ByVal new_y2 As Integer = 1)
    MyBase.New(fore_color, fill_color, line_width)

    X1 = new_x1
    Y1 = new_y1
    X2 = new_x2
    Y2 = new_y2


    Trace.WriteLine(s_InsertLabel)


End Sub


Friend WriteOnly Property _textBox() As String

    Set(ByVal Value As String)

        s_InsertLabel = Value
        Trace.WriteLine(s_InsertLabel)

    End Set

End Property



' Draw the object on this Graphics surface.
Public Overrides Sub Draw(ByVal gr As System.Drawing.Graphics)


    ' Make a Rectangle representing this rectangle.
    Dim rect As Rectangle = GetBounds()

    ' Fill the rectangle as usual.
    Dim fill_brush As New SolidBrush(FillColor)
    gr.FillRectangle(fill_brush, rect)
    fill_brush.Dispose()

    ' See if we're selected.
    If IsSelected Then


        ' Draw the rectangle highlighted.
        Dim highlight_pen As New Pen(Color.Yellow, LineWidth)
        gr.DrawRectangle(highlight_pen, rect)
        highlight_pen.Dispose()


        ' Draw grab handles.
        Trace.WriteLine("drawing the lines for my textbox")
        DrawGrabHandle(gr, X1, Y1)
        DrawGrabHandle(gr, X1, Y2)
        DrawGrabHandle(gr, X2, Y2)
        DrawGrabHandle(gr, X2, Y1)

    Else


        'TextBox()
        Dim fg_pen As New Pen(Color.Red, LineWidth)
        'Dim fontSize As Single = 0.1 + ((Y2 - Y1) / 2)
        Dim fontSize As Single = 20

        Try



            Dim drawFont As New Font("Arial", fontSize, FontStyle.Bold)
            Trace.WriteLine(s_InsertLabel)
            gr.DrawString(s_InsertLabel, drawFont, Brushes.Brown, X1, Y1)
        Catch ex As ArgumentException



        End Try
        gr.DrawRectangle(Pens.Azure, rect)
        ' gr.DrawRectangle(fg_pen, rect)
        fg_pen.Dispose()


    End If

End Sub


Public Function GetValueString(ByVal ValueType As String)
    Return ValueType
End Function

' Return the object's bounding rectangle.
Public Overrides Function GetBounds() As System.Drawing.Rectangle
    Return New Rectangle( _
        Min(X1, X2), _
        Min(Y1, Y2), _
        Abs(100), _
        Abs(30))
    Trace.WriteLine("don't forget to make variables in GetBounds DrawableTextbox")
End Function


' Return True if this point is on the object.
Public Overrides Function IsAt(ByVal x As Integer, ByVal y As Integer) As Boolean
    Return (x >= Min(X1, X2)) AndAlso _
           (x <= Max(X1, X2)) AndAlso _
           (y >= Min(Y1, Y2)) AndAlso _
           (y <= Max(Y1, Y2))
End Function

' Move the second point.
Public Overrides Sub NewPoint(ByVal x As Integer, ByVal y As Integer)
    X2 = x
    Y2 = y
End Sub

' Return True if the object is empty (e.g. a zero-length line).
Public Overrides Function IsEmpty() As Boolean
    Return (X1 = X2) AndAlso (Y1 = Y2)
End Function


End Class

I’ve got a form with a textbox( form1) in which the text is being inserted and passed through a buttonclick (al via properties).

As you can see I’ve placed several traces and in the property of the class my trace works fine , however if I look in my Draw function it is already gone.

And I get a blank trace.
Does anyone know what’s happening here.
thanks in advance.

(forgive me I’m new )

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T06:59:22+00:00Added an answer on May 14, 2026 at 6:59 am

    I figured out a way of getting what I want.

    I created a new Form in my new method( constructor) of the class and use Dialogresult to get the correct string from my textbox.
    Like so

      Dim frm As New Form1
            frm.ShowDialog()
            If frm.DialogResult = DialogResult.OK Then
                s_InsertLabel = frm.TextBox2.Text
            End If
    

    Thanks both for your quick respons much appreciated.

    For now I am ok but I’m sure in the future I will be asking more questions

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 357k
  • Answers 357k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You probably want to call setlocale() first, "LC_ALL" should do… May 14, 2026 at 9:06 am
  • Editorial Team
    Editorial Team added an answer Linux Ubuntu Desktop Jaunty Firebug FireCookie Pixel Perfect Web developer… May 14, 2026 at 9:06 am
  • Editorial Team
    Editorial Team added an answer Your code should look like this: var par = [];… May 14, 2026 at 9:06 am

Related Questions

I am currently building my Core Data model, which I would like to sync
Short version: Is there a simple, built-in way to identify the calling view in
So I was wondering what should be done with HTTP Content Negotiation regarding requests
I have a scenario where I have a timezone offset (in minutes) and need
I've been doing some research on Nagle's algorithm out of idle curiousity. I understand

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.