Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I am trying to create a picture by code, by copying some of the stuff out of the form designer i have come up with.

 

  Private Sub frmMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  
     Dim PicBox_1_2 As New PictureBox
     '      Dim PicBox_1_3 As New PictureBox
     '
     'PicBox_1_2
     '
     PicBox_1_2.Location = New System.Drawing.Point(80, 84)
     PicBox_1_2.Name = "PicBox_1_2"
     PicBox_1_2.Size = New System.Drawing.Size(100, 92)
     PicBox_1_2.TabIndex = 0
     PicBox_1_2.TabStop = False
     PicBox_1_2.BackColor = Color.Red 

  End Sub

 

But it doesnt show. have i missed something?

  • 2 weeks later...
Posted

I have a simular problem, and read this thread - the answer helped me half-way. I have a question to addend to the original question.

 

When I add the object to the control of the form, on the form there is a group box. I want to put the object in the group-box. If I add it to the form, it's putting behind the group box. If I add to the group box like this:

 

mForm.groupbox1.Controls.Add(textBoxCustom)

 

It always puts it in the title of the group box, no matter if i change the position of the textbox.

 

Any ideas?

www.DRSTEIN99.com www.RAIDGEAR.net www.THERE.com -> Tell them DrStein99 sent ya!
  • *Experts*
Posted

If im understanding right what you mean by saying it puts it in the title, then I dont have that problem, it works all right for me.

What code are you using the create the TextBox?

Posted

I figured it out. Here is the code:

 

Dim tb1 As New TextBox

tb1.Location = New Point(15, 15) 'this line of code

tb1.Visible = True

tb1.Text = "TEST INFORMATION"

tb1.ForeColor = Color.RosyBrown

tb1.BorderStyle = BorderStyle.None

'tb1.Location.X.Equals(22)

'tb1.Location.Y.Equals(22)

tb1.Size.Height.Equals(15)

tb1.Size.Width.Equals(280)

mFormScript.rtScript.Controls.Add(tb1)

 

Where "this line of code" is where I needed to add. Was using "tb1.location.x.equals(22)" - with no results.

www.DRSTEIN99.com www.RAIDGEAR.net www.THERE.com -> Tell them DrStein99 sent ya!
Posted

Ok while we're on the same page I got another question around the same topic.

 

I want to create a textbox and add to the richtextedit (which was done - i.e.: earlier posts)

 

when i do:

 

dim tb as new textbox

 

and then:

 

mFormScript.rtScript.Controls.Add(tb1)

 

I want to be able to make the name of the object from a string, like pass the function a parameter:

 

private sub createnewtextbox(byval prmInString as string)

 

dim prmInString as newtextbox

mFormScript.rtScript.Controls.Add(prmInString)

 

 

 

how do i do this?

www.DRSTEIN99.com www.RAIDGEAR.net www.THERE.com -> Tell them DrStein99 sent ya!
Posted

It´s very funny...

 

At the moment I´m writting a application for a printing company and the same problem makes me sad since a few weeks.

 

It is not possible to solve this!!!!

 

I have in many many forums asked this question, last at microsoft ..... no answer. SORRY !!

 

My problem have i solved in a other way, when you describe your´s more exactly maybe I can help you...

 

Let us communicate further in this post, I´m the whole online (programming...... :-) )

Posted

I'm writing a data-capture application. It uses a rich text box to populate from a memo field in a msaccess table (currently)

 

The information is displayed on the screen read-only mode. Simular to filling out a job application I.E.:

 

 

What is your first name **overlapping textbox goes here**

have you ever been married **next overlapping textobx **

 

 

The pages will vary at random with a different list of questions to be answered.

www.DRSTEIN99.com www.RAIDGEAR.net www.THERE.com -> Tell them DrStein99 sent ya!
  • *Experts*
Posted

Drstein, I see where your problem lies.

'tb1.Location.X.Equals(22)
'tb1.Location.Y.Equals(22)
tb1.Size.Height.Equals(15)
tb1.Size.Width.Equals(280)

 

I see that the first two lines are commented out, but you made

the same mistake for all four. The Equals method that all types

have is a function that returns a boolean value telling whether the

value passed to it is equal to the object itself. It is not a setter

function such as you might have in a property declaration. It is

just a function that returns a value. Your code will work correctly

if you use the = operator like so:

 

tb1.Location.X = 22
tb1.Location.Y = 22
tb1.Size.Height = 15
tb1.Size.Width = 280

"Being grown up isn't half as fun as growing up

These are the best days of our lives"

-The Ataris, In This Diary

  • *Experts*
Posted

For setting the size and location, use the constructor of

the Point and Size structures:

 

tb1.Location = New Point(22, 22)
tb1.Size = New Size(280, 15)

 

As for accessing the control later, store it in a form-level variable

that you can change properties of and such, or remove from the

Controls collection when you want to remove it.

 

' This is in general declarations:
Dim myControl As TextBox

' Then, when you want to init it:
myControl = New TextBox()
' Set the properties here
Me.Controls.Add(myControl)

' And to dispose of it:
Me.Controls.Remove(myControl)
myControl.Dispose()
myControl = Nothing

"Being grown up isn't half as fun as growing up

These are the best days of our lives"

-The Ataris, In This Diary

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...