|
-
Jul 14th, 2010, 08:47 PM
#1
Thread Starter
PowerPoster
A Form In A Ctrl Array And Then...
I am making a Form Control Array, that part I have down pat. But then trying to get a PictureBox to be different sizes, in each of them. Or atleast it can be, if you choose the same command button to do that, then it will be the same. The sizes of the PictureBox is pre-defined at design-time and assigned to a Command Button as such.
How can I do this, and make it work right. I have tried everything. So then trying to ask the Lex-Mechanics (Programmers) of the Forum to help me.
Here is the current Source Code that I am working on...
Code:
Public Sub Command1_Click()
On Error Resume Next
Dim NF As New Form11
ReDim Preserve F(CountOfForms) As Form
If Form2.Text4.Text = "0" Then
l = 0
l = l + 1
Else
If Form2.Text4.Text = "" Then
l = l + 1
End If
End If
Filename = Form2.Text2.Text
Load NF
NF.Hide
Set F(CountOfForms) = NF
CountOfForms = CountOfForms + 1
Rem This is the Exit Sub.
If Form2.Text1.Text = "0" Then
Exit Sub
Else
Rem This is the Open.
If Form2.Text1.Text = "1" Then
NF.TitleBar1.Visible = True
NF.MenuBar1.Visible = False
NF.BackGround1(Form1.List1.ItemData(Form1.List1.ListIndex)).Height = 320
NF.BackGround1(Form1.List1.ItemData(Form1.List1.ListIndex)).Width = 460
Else
Rem This is the Save As.
If Form2.Text1.Text = "2" Then
NF.TitleBar1.Visible = True
NF.MenuBar1.Visible = False
NF.BackGround1(Form1.List1.ItemData(Form1.List1.ListIndex)).Height = 320
NF.BackGround1(Form1.List1.ItemData(Form1.List1.ListIndex)).Width = 460
Else
Rem This is the Colour Chooser.
If Form2.Text1.Text = "4" Then
NF.TitleBar1.Visible = True
NF.MenuBar1.Visible = False
NF.BackGround1(Form1.List1.ItemData(Form1.List1.ListIndex)).Height = 320
NF.BackGround1(Form1.List1.ItemData(Form1.List1.ListIndex)).Width = 460
Else
Rem This is the Printer Setup.
If Form2.Text1.Text = "5" Then
NF.TitleBar1.Visible = True
NF.MenuBar1.Visible = False
NF.BackGround1(Form1.List1.ItemData(Form1.List1.ListIndex)).Height = 320
NF.BackGround1(Form1.List1.ItemData(Form1.List1.ListIndex)).Width = 460
Else
Rem This is the Font Chooser.
If Form2.Text1.Text = "6" Then
NF.TitleBar1.Visible = True
NF.MenuBar1.Visible = False
NF.BackGround1(Form1.List1.ItemData(Form1.List1.ListIndex)).Height = 320
NF.BackGround1(Form1.List1.ItemData(Form1.List1.ListIndex)).Width = 460
Else
Rem This is the Dialog Box.
If Form2.Text1.Text = "7" Then
NF.TitleBar1.Visible = True
NF.MenuBar1.Visible = False
NF.BackGround1(Form1.List1.ItemData(Form1.List1.ListIndex)).Height = 320
NF.BackGround1(Form1.List1.ItemData(Form1.List1.ListIndex)).Width = 460
Else
Rem This is the User Form.
If Form2.Text1.Text = "8" Then
NF.TitleBar1.Visible = True
NF.MenuBar1.Visible = True
NF.BackGround1(Form1.List1.ItemData(Form1.List1.ListIndex)).Height = 900
NF.BackGround1(Form1.List1.ItemData(Form1.List1.ListIndex)).Width = 1400
Else
Rem This is the Video in a Window.
If Form2.Text1.Text = "9" Then
NF.TitleBar1.Visible = True
NF.MenuBar1.Visible = False
NF.BackGround1(Form1.List1.ItemData(Form1.List1.ListIndex)).Height = 200
NF.BackGround1(Form1.List1.ItemData(Form1.List1.ListIndex)).Width = 460
Else
Rem This is the Splash Screen.
If Form2.Text1.Text = "10" Then
Form10.Combo16.Enabled = True
Form10.Combo16.AddItem "Form" & l
NF.TitleBar1.Visible = False
NF.MenuBar1.Visible = False
NF.BackGround1(Form1.List1.ItemData(Form1.List1.ListIndex)).Height = 480
NF.BackGround1(Form1.List1.ItemData(Form1.List1.ListIndex)).Width = 720
Else
Rem This is the Message Box.
If Form2.Text1.Text = "11" Then
NF.TitleBar1.Visible = True
NF.MenuBar1.Visible = False
NF.BackGround1(Form1.List1.ItemData(Form1.List1.ListIndex)).Height = 300
NF.BackGround1(Form1.List1.ItemData(Form1.List1.ListIndex)).Width = 720
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
NF.Hide
Form1.cmd_MakeMenu1.Enabled = True
Form1.MenuBar_Insert.Enabled = True
Form1.List1.AddItem "Form" & l & ":" & " " & Filename & ".frm"
Form1.List1.ItemData(Form1.List1.NewIndex) = l
Form12.Combo4.AddItem "Form" & l
Form12.Combo4.ItemData(Form12.Combo4.NewIndex) = l
Form10.Combo19.AddItem "Form" & l
Form12.List1.AddItem "Form" & l
Form12.lstKeywords.AddItem "Form" & l
Form14.Combo2.AddItem "Form" & l
Form14.Combo1.AddItem "Form"
Form2.Hide
Form10.Hide
Form12.Hide
Form13.Hide
Form14.Hide
Form2.Text1.Text = "0"
Form2.Text2.Text = "Untitled" & ".frm"
Form1.Text2.Text = "1"
Form2.Text4.Text = ""
Form1.DrawGuides_View.Enabled = True
Form2.Text2.Enabled = False
Form2.Command1.Enabled = False
Form1.Enabled = True
Form10.Enabled = True
Form11.Enabled = True
Form12.Enabled = True
Form13.Enabled = True
Form14.Enabled = True
End Sub
!! Thanks in advance !!
Last edited by ThEiMp; Jul 14th, 2010 at 08:51 PM.
I have a huge free products range, of computer software in which you can download using any kind of 64-Bit Web Browser. Also there is coming a Social Networking section that I am making on my Website...
|Ambra Productions Inc. | The Black Sun Society | The Black Shield | Ambra College | Church of the Black Sun | Ambra Productions Inc's Homepage | Boomtick Venues: Ambar Nightclub, Jack Rabbit Slim's, Villa Nightclub and Lucy's Love Shack | Pasta Ambra | Fish Feast Company | Wallet Wizard | Ambrose Liquor | Ambar Tavern | Ambra University | Ambra Cheese |
Do you wish to do unpaid work for me??? If so, the PM me on this Forum, and then we can get to work, programming for the future of computers go by the name of ThEiMp. This is my ghost writers name. Also my nickname, means that I am: The Imperial of the Technology Industry, so then to make it really short, I just then wrote: The Imp, which is where I get the nickname from...
-
Jul 15th, 2010, 06:04 AM
#2
Re: A Form In A Ctrl Array And Then...
you should be indenting your code much better, each if should be indented from the previous
i believe you would be much better off using elseif, or even better using a
select case form2.text1.text
do i assume your picturebox is background1?
what happens with the code as it is now?
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Jul 15th, 2010, 08:03 PM
#3
Thread Starter
PowerPoster
Re: A Form In A Ctrl Array And Then...
Well it works, and I have been doing it that way for a longtime!!
Also: What is the command to select a certain type of element in a control array, in this case it is a Form Control Array???
Thanks in advance!!
I have a huge free products range, of computer software in which you can download using any kind of 64-Bit Web Browser. Also there is coming a Social Networking section that I am making on my Website...
|Ambra Productions Inc. | The Black Sun Society | The Black Shield | Ambra College | Church of the Black Sun | Ambra Productions Inc's Homepage | Boomtick Venues: Ambar Nightclub, Jack Rabbit Slim's, Villa Nightclub and Lucy's Love Shack | Pasta Ambra | Fish Feast Company | Wallet Wizard | Ambrose Liquor | Ambar Tavern | Ambra University | Ambra Cheese |
Do you wish to do unpaid work for me??? If so, the PM me on this Forum, and then we can get to work, programming for the future of computers go by the name of ThEiMp. This is my ghost writers name. Also my nickname, means that I am: The Imperial of the Technology Industry, so then to make it really short, I just then wrote: The Imp, which is where I get the nickname from...
-
Jul 16th, 2010, 01:20 AM
#4
Re: A Form In A Ctrl Array And Then...
 Originally Posted by ThEiMp
Well it works, and I have been doing it that way for a longtime!!
That still doesn't make it right.
Here are some good reads for code indenting: http://en.wikipedia.org/wiki/Indent_style
programming style http://en.wikipedia.org/wiki/Programming_style and naming conventions http://en.wikipedia.org/wiki/Identif...ing_convention most notably the Hungarian notation http://en.wikipedia.org/wiki/Hungarian_notation
Also: What is the command to select a certain type of element in a control array, in this case it is a Form Control Array???
Code:
Dim c As Control
For Each c In Form1.Controls
If TypeOf c Is TextBox Then
c.ForeColor = vbRed
End If
Next
Last edited by baja_yu; Jul 16th, 2010 at 01:24 AM.
-
Jul 21st, 2010, 08:26 PM
#5
Thread Starter
PowerPoster
Re: A Form In A Ctrl Array And Then...
Can someone please help me, I am in deed in trouble with this section of code???
I have a huge free products range, of computer software in which you can download using any kind of 64-Bit Web Browser. Also there is coming a Social Networking section that I am making on my Website...
|Ambra Productions Inc. | The Black Sun Society | The Black Shield | Ambra College | Church of the Black Sun | Ambra Productions Inc's Homepage | Boomtick Venues: Ambar Nightclub, Jack Rabbit Slim's, Villa Nightclub and Lucy's Love Shack | Pasta Ambra | Fish Feast Company | Wallet Wizard | Ambrose Liquor | Ambar Tavern | Ambra University | Ambra Cheese |
Do you wish to do unpaid work for me??? If so, the PM me on this Forum, and then we can get to work, programming for the future of computers go by the name of ThEiMp. This is my ghost writers name. Also my nickname, means that I am: The Imperial of the Technology Industry, so then to make it really short, I just then wrote: The Imp, which is where I get the nickname from...
-
Jul 22nd, 2010, 04:21 AM
#6
Re: A Form In A Ctrl Array And Then...
Well it works, and I have been doing it that way for a longtime!!
Can someone please help me, I am in deed in trouble with this section of code???
what problem do you have? please clarify your question
Also: What is the command to select a certain type of element in a control array, in this case it is a Form Control Array???
what does this mean?
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Jul 22nd, 2010, 08:56 AM
#7
Re: A Form In A Ctrl Array And Then...
The reason they are asking you to indent your code is so they can HELP YOU.
It is easy for the author to know what hard-to-read code is, they wrote it! But for someone who has to figure it out, writing it in a confusing manner makes it difficult. Why would you want to make it hard for people to help you? Here's a hint: the easier you make it for people to help you the more likely you are to get help. We want to help, but can't if it is too difficult.
Not sure what you mean by
What is the command to select a certain type of element in a control array, in this case it is a Form Control Array???
If you mean assign one, then you would do it like this:
Code:
ctl = NF.BackGround1(intIndex)
See how I prefixed the index with int. It communicates to you that it is an integer so you have a better understanding. That's one of the things baja_vu was trying to tell you.
If you mean select it on the form then:
Code:
NF.BackGround1(intIndex).SetFocus
-
Jul 22nd, 2010, 04:25 PM
#8
Re: A Form In A Ctrl Array And Then...
It is easy for the author to know what hard-to-read code is,
not even the author after a few months
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Jul 22nd, 2010, 07:40 PM
#9
Thread Starter
PowerPoster
Re: A Form In A Ctrl Array And Then...
Let me get this right here, before I try it out on my project???
Code:
Option Explicit
'
Dim intIndex As Integer
'
Right???
Code:
Public Sub Command1_Click()
ctl = NF.BackGround1(intIndex).Height = 240
ctl = NF.BackGround1(intIndex).Width = 180
End Sub
Right???
Last edited by ThEiMp; Jul 22nd, 2010 at 07:45 PM.
I have a huge free products range, of computer software in which you can download using any kind of 64-Bit Web Browser. Also there is coming a Social Networking section that I am making on my Website...
|Ambra Productions Inc. | The Black Sun Society | The Black Shield | Ambra College | Church of the Black Sun | Ambra Productions Inc's Homepage | Boomtick Venues: Ambar Nightclub, Jack Rabbit Slim's, Villa Nightclub and Lucy's Love Shack | Pasta Ambra | Fish Feast Company | Wallet Wizard | Ambrose Liquor | Ambar Tavern | Ambra University | Ambra Cheese |
Do you wish to do unpaid work for me??? If so, the PM me on this Forum, and then we can get to work, programming for the future of computers go by the name of ThEiMp. This is my ghost writers name. Also my nickname, means that I am: The Imperial of the Technology Industry, so then to make it really short, I just then wrote: The Imp, which is where I get the nickname from...
-
Jul 22nd, 2010, 10:22 PM
#10
Re: A Form In A Ctrl Array And Then...
no
ctl = NF.BackGround1(intIndex).Height = 240
ctl will be true or false depending on the height of nf.background1(intindex)
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Jul 23rd, 2010, 09:10 PM
#11
Thread Starter
PowerPoster
Re: A Form In A Ctrl Array And Then...
Problem: I tried your source code. It didn't work. No change in the flow of the processes.
I am trying to get the .Height and the .Width of a PictureBox on a certain Form to be a different size. This is set or rather defined at run-time of the program.
I have a huge free products range, of computer software in which you can download using any kind of 64-Bit Web Browser. Also there is coming a Social Networking section that I am making on my Website...
|Ambra Productions Inc. | The Black Sun Society | The Black Shield | Ambra College | Church of the Black Sun | Ambra Productions Inc's Homepage | Boomtick Venues: Ambar Nightclub, Jack Rabbit Slim's, Villa Nightclub and Lucy's Love Shack | Pasta Ambra | Fish Feast Company | Wallet Wizard | Ambrose Liquor | Ambar Tavern | Ambra University | Ambra Cheese |
Do you wish to do unpaid work for me??? If so, the PM me on this Forum, and then we can get to work, programming for the future of computers go by the name of ThEiMp. This is my ghost writers name. Also my nickname, means that I am: The Imperial of the Technology Industry, so then to make it really short, I just then wrote: The Imp, which is where I get the nickname from...
-
Jul 23rd, 2010, 10:14 PM
#12
Re: A Form In A Ctrl Array And Then...
NF.BackGround1(Form1.List1.ItemData(Form1.List1.ListIndex)).Height = 320
what is in form1.list1.itemdata for that index?
is background1 a control array?
if so is it dynamically created?
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Jul 24th, 2010, 10:29 PM
#13
Thread Starter
PowerPoster
Re: A Form In A Ctrl Array And Then...
Form1.List1.ItemData (l = l + 1), everytime it is executed.
Form11.BackGround1 = A Form Ctrl Array.
And yes it is dynamically created at run-time.
I have a huge free products range, of computer software in which you can download using any kind of 64-Bit Web Browser. Also there is coming a Social Networking section that I am making on my Website...
|Ambra Productions Inc. | The Black Sun Society | The Black Shield | Ambra College | Church of the Black Sun | Ambra Productions Inc's Homepage | Boomtick Venues: Ambar Nightclub, Jack Rabbit Slim's, Villa Nightclub and Lucy's Love Shack | Pasta Ambra | Fish Feast Company | Wallet Wizard | Ambrose Liquor | Ambar Tavern | Ambra University | Ambra Cheese |
Do you wish to do unpaid work for me??? If so, the PM me on this Forum, and then we can get to work, programming for the future of computers go by the name of ThEiMp. This is my ghost writers name. Also my nickname, means that I am: The Imperial of the Technology Industry, so then to make it really short, I just then wrote: The Imp, which is where I get the nickname from...
-
Jul 24th, 2010, 11:54 PM
#14
Re: A Form In A Ctrl Array And Then...
i rewrote the first section of your code, to make it more readable and understandable for others, it will also run faster as there is many fewer conditions to evaluate
are the height and width of background1 not being changed in your existing code?
can you post form11?
vb Code:
Dim NF As New Form11, idx As Integer ReDim Preserve F(CountOfForms) As Form If Form2.Text4.Text = "0" Then l = 0 l = l + 1 Filename = Form2.Text2.Text Load NF NF.Hide Set F(CountOfForms) = NF CountOfForms = CountOfForms + 1 idx = Form1.List1.ItemData(Form1.List1.ListIndex) Select Case Val(Form2.Text1.Text) 'Rem This is the Exit Sub. Case 0: Exit Sub 'Rem This is the Open, saveas, color, printer, font, dialog Case 1, 2, 4 To 7 ' all use same setting NF.TitleBar1.Visible = True NF.MenuBar1.Visible = False NF.BackGround1(idx).Height = 320 NF.BackGround1(idx).Width = 460 'Rem This is the User Form. Case 8 NF.TitleBar1.Visible = True NF.MenuBar1.Visible = True NF.BackGround1(idx).Height = 900 NF.BackGround1(idx).Width = 1400 'Rem This is the Video in a Window. Case 9 NF.TitleBar1.Visible = True NF.MenuBar1.Visible = False NF.BackGround1(idx).Height = 200 NF.BackGround1(idx).Width = 460 'Rem This is the Splash Screen. Case 10 Form10.Combo16.Enabled = True Form10.Combo16.AddItem "Form" & l NF.TitleBar1.Visible = False NF.MenuBar1.Visible = False NF.BackGround1(idx).Height = 480 NF.BackGround1(idx).Width = 720 'Rem This is the Message Box. Case 11 NF.TitleBar1.Visible = True NF.MenuBar1.Visible = False NF.BackGround1(idx).Height = 300 NF.BackGround1(idx).Width = 720 Case Else 'in case some other value is entered End Select NF.Hide
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Jul 25th, 2010, 12:13 AM
#15
Thread Starter
PowerPoster
Re: A Form In A Ctrl Array And Then...
Form11, is just adding the ActiveX controls to the Form. Eg: Point and Click on the PictureBox that meant to be all on Form11. But the buttons in the ToolBox are found on Form1, and so are the other processes found in Form1. eg: Menus, etc...
Anyway: Here it is in a downloadable version. Cause I am not quite sure how many lines the CODE tags are able to take???
Last edited by ThEiMp; Nov 2nd, 2010 at 08:52 PM.
I have a huge free products range, of computer software in which you can download using any kind of 64-Bit Web Browser. Also there is coming a Social Networking section that I am making on my Website...
|Ambra Productions Inc. | The Black Sun Society | The Black Shield | Ambra College | Church of the Black Sun | Ambra Productions Inc's Homepage | Boomtick Venues: Ambar Nightclub, Jack Rabbit Slim's, Villa Nightclub and Lucy's Love Shack | Pasta Ambra | Fish Feast Company | Wallet Wizard | Ambrose Liquor | Ambar Tavern | Ambra University | Ambra Cheese |
Do you wish to do unpaid work for me??? If so, the PM me on this Forum, and then we can get to work, programming for the future of computers go by the name of ThEiMp. This is my ghost writers name. Also my nickname, means that I am: The Imperial of the Technology Industry, so then to make it really short, I just then wrote: The Imp, which is where I get the nickname from...
-
Jul 25th, 2010, 12:31 AM
#16
Re: A Form In A Ctrl Array And Then...
are the height and width of background1 not being changed in your existing code?
you still did not answer on this
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Jul 25th, 2010, 01:23 AM
#17
Thread Starter
PowerPoster
Re: A Form In A Ctrl Array And Then...
Sorry...
Yes, the .Height and .Width can be changed if you user wishes to do so. But there are .Height and .Width default settings, which can be changed when the program is in the Design Mode. (My Program's Design Mode, which is its run-time for the project).
Also now I changed the code to work with different buttons to select different Form types. Like ActiveX control to UserForm types. To make it more simpler, I was thinking. Now it looks, a right mess in deed!!
If I post this file, as a downloadable version could you have a look. I am going to run it through an external debugger, to get what is really going on with it!!
And I don't think that I should have said, that? Because no one on the outside of my project headquaters. Should know of that program, that they exist!!
I have a huge free products range, of computer software in which you can download using any kind of 64-Bit Web Browser. Also there is coming a Social Networking section that I am making on my Website...
|Ambra Productions Inc. | The Black Sun Society | The Black Shield | Ambra College | Church of the Black Sun | Ambra Productions Inc's Homepage | Boomtick Venues: Ambar Nightclub, Jack Rabbit Slim's, Villa Nightclub and Lucy's Love Shack | Pasta Ambra | Fish Feast Company | Wallet Wizard | Ambrose Liquor | Ambar Tavern | Ambra University | Ambra Cheese |
Do you wish to do unpaid work for me??? If so, the PM me on this Forum, and then we can get to work, programming for the future of computers go by the name of ThEiMp. This is my ghost writers name. Also my nickname, means that I am: The Imperial of the Technology Industry, so then to make it really short, I just then wrote: The Imp, which is where I get the nickname from...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|