Dynamic Array

Hi I have the following code:


 
Public Class WebForm1
    Inherits System.Web.UI.Page
    Public partitions(50, 3) As String
    Dim lblNoParts, lblNoParts2 As New Label

#Region " Web Form Designer Generated Code "

    'This call is required by the Web Form Designer.
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

    End Sub
    Protected WithEvents Button1 As System.Web.UI.WebControls.Button
    Protected WithEvents Form1 As System.Web.UI.HtmlControls.HtmlForm
    Protected WithEvents Button2 As System.Web.UI.WebControls.Button
    Protected WithEvents Button3 As System.Web.UI.WebControls.Button
    Protected WithEvents mount As System.Web.UI.WebControls.TextBox
    Protected WithEvents filesystem As System.Web.UI.WebControls.DropDownList
    Protected WithEvents size As System.Web.UI.WebControls.TextBox
    Protected WithEvents disk As System.Web.UI.WebControls.DropDownList
    Protected WithEvents Message As System.Web.UI.WebControls.Label
    Protected WithEvents PH_HDA As System.Web.UI.WebControls.PlaceHolder
    Protected WithEvents PH_HDB As System.Web.UI.WebControls.PlaceHolder

    'NOTE: The following placeholder declaration is required by the Web Form Designer.
    'Do not delete or move it.
    Private designerPlaceholderDeclaration As System.Object

    Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
        'CODEGEN: This method call is required by the Web Form Designer
        'Do not modify it using the code editor.
        InitializeComponent()
    End Sub

#End Region

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim i, count As Integer

        lblNoParts.Text = "Currently NO partitions assigned."

        PH_HDA.Controls.Add(New LiteralControl("<tr><td class='table' colSpan='3'>"))
        PH_HDA.Controls.Add(lblNoParts)
        PH_HDA.Controls.Add(New LiteralControl("</td></tr>"))

        lblNoParts2.Text = "Currently NO partitions assigned."
        PH_HDB.Controls.Add(New LiteralControl("<tr><td class='table' colSpan='3'>"))
        PH_HDB.Controls.Add(lblNoParts2)
        PH_HDB.Controls.Add(New LiteralControl("</td></tr>"))

        'default parts
        '/boot
        partitions(0, 0) = "/boot"
        partitions(0, 1) = "ext2"
        partitions(0, 2) = "100"
        partitions(0, 3) = "hda"

        'SWAP
        partitions(1, 0) = ""
        partitions(1, 1) = "SWAP"
        partitions(1, 2) = "1024"
        partitions(1, 3) = "hda"

        '/
        partitions(2, 0) = "/"
        partitions(2, 1) = "ext3"
        partitions(2, 2) = "20480"
        partitions(2, 3) = "hda"

        '/home
        partitions(3, 0) = "/home"
        partitions(3, 1) = "ext3"
        partitions(3, 2) = "*"
        partitions(3, 3) = "hdb"

        For i = 4 To 50
            partitions(i, 0) = ""
            partitions(i, 1) = ""
            partitions(i, 2) = ""
            partitions(i, 3) = ""
        Next

        For i = 0 To 50

            If partitions(i, 0) = "" And partitions(i, 1) = "" And partitions(i, 2) = "" And partitions(i, 3) = "" Then
                Exit For
            Else

                If partitions(i, 3).Equals("hda") Then
                    PH_HDA.Controls.Clear()
                ElseIf partitions(i, 3).Equals("hdb") Then
                    PH_HDB.Controls.Clear()
                End If

            End If

        Next

        For i = 0 To 50

            If partitions(i, 0) = "" And partitions(i, 1) = "" And partitions(i, 2) = "" And partitions(i, 3) = "" Then
                Exit For
            Else

                Dim NewTextBox As New TextBox
                Dim NewTextBoxSize As New TextBox
                Dim NewSelectBox As New DropDownList
                Dim NewSelectBoxHD As New DropDownList
                Dim update As New Button
                Dim remove As New Button

                If partitions(i, 3).Equals("hda") Then

                    'Mount texbox instellen
                    NewTextBox.ID = "Mount" & i
                    NewTextBox.CssClass = "field"
                    NewTextBox.Text = partitions(i, 0)

                    'Filesystem selectbox instellen
                    NewSelectBox.ID = "FileSystem" & i
                    NewSelectBox.CssClass = "drop"
                    NewSelectBox.Items.Add("ext2")
                    NewSelectBox.Items.Add("ext3")
                    NewSelectBox.Items.Add("LVM")
                    NewSelectBox.Items.Add("RAID")
                    NewSelectBox.Items.Add("SWAP")
                    NewSelectBox.Items.Add("vfat")
                    NewSelectBox.SelectedValue = partitions(i, 1)
                    'Size texbox instellen

                    NewTextBoxSize.ID = "Size" & i
                    NewTextBoxSize.CssClass = "field"
                    NewTextBoxSize.Text = partitions(i, 2)

                    'update knop
                    update.ID = "update" & i
                    update.Text = "Update"
                    update.CssClass = "button"

                    'remove knop
                    remove.ID = "remove" & i
                    remove.Text = "Remove"
                    remove.CssClass = "button"

                    PH_HDA.Controls.Add(New LiteralControl("<tr><td class='table'>"))
                    PH_HDA.Controls.Add(NewTextBox)
                    PH_HDA.Controls.Add(New LiteralControl("&nbsp;"))
                    PH_HDA.Controls.Add(NewSelectBox)
                    PH_HDA.Controls.Add(New LiteralControl("&nbsp;"))
                    PH_HDA.Controls.Add(NewTextBoxSize)
                    PH_HDA.Controls.Add(New LiteralControl("</td>"))
                    PH_HDA.Controls.Add(New LiteralControl("<td class='table' colSpan='2' align='right'>"))
                    PH_HDA.Controls.Add(update)
                    PH_HDA.Controls.Add(New LiteralControl("&nbsp;"))
                    PH_HDA.Controls.Add(remove)
                    PH_HDA.Controls.Add(New LiteralControl("</td></tr>"))

                ElseIf partitions(i, 3).Equals("hdb") Then

                    'Mount texbox instellen
                    NewTextBox.ID = "Mount" & i
                    NewTextBox.CssClass = "field"
                    NewTextBox.Text = partitions(i, 0)

                    'Filesystem selectbox instellen
                    NewSelectBox.ID = "FileSystem" & i
                    NewSelectBox.CssClass = "drop"
                    NewSelectBox.Items.Add("ext2")
                    NewSelectBox.Items.Add("ext3")
                    NewSelectBox.Items.Add("LVM")
                    NewSelectBox.Items.Add("RAID")
                    NewSelectBox.Items.Add("swap")
                    NewSelectBox.Items.Add("vfat")
                    NewSelectBox.SelectedValue = partitions(i, 1)
                    'Size texbox instellen

                    NewTextBoxSize.ID = "Size" & i
                    NewTextBoxSize.CssClass = "field"
                    NewTextBoxSize.Text = partitions(i, 2)

                    'update knop
                    update.ID = "update" & i
                    update.Text = "Update"
                    update.CssClass = "button"

                    'remove knop
                    remove.ID = "remove" & i
                    remove.Text = "Remove"
                    remove.CssClass = "button"

                    PH_HDB.Controls.Add(New LiteralControl("<tr><td class='table'>"))
                    PH_HDB.Controls.Add(NewTextBox)
                    PH_HDB.Controls.Add(New LiteralControl("&nbsp;"))
                    PH_HDB.Controls.Add(NewSelectBox)
                    PH_HDB.Controls.Add(New LiteralControl("&nbsp;"))
                    PH_HDB.Controls.Add(NewTextBoxSize)
                    PH_HDB.Controls.Add(New LiteralControl("</td>"))
                    PH_HDB.Controls.Add(New LiteralControl("<td class='table' colSpan='2' align='right'>"))
                    PH_HDB.Controls.Add(update)
                    PH_HDB.Controls.Add(New LiteralControl("&nbsp;"))
                    PH_HDB.Controls.Add(remove)
                    PH_HDB.Controls.Add(New LiteralControl("</td></tr>"))

                End If

            End If

        Next
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim i, x As Integer
        Dim label As New Label

        For i = 0 To 50

            If partitions(i, 0) = "" And partitions(i, 1) = "" And partitions(i, 2) = "" And partitions(i, 3) = "" Then
                x = x + 1
            End If

        Next

        x = x - 1
        x = 50 - x

        partitions(x, 0) = mount.Text
        partitions(x, 1) = filesystem.SelectedItem.Value
        partitions(x, 2) = size.Text
        partitions(x, 3) = disk.SelectedItem.Value

        For i = 0 To 50

            If partitions(i, 0) = "" And partitions(i, 1) = "" And partitions(i, 2) = "" And partitions(i, 3) = "" Then
                Exit For
            Else

                If partitions(i, 3).Equals("hda") Then
                    PH_HDA.Controls.Clear()
                ElseIf partitions(i, 3).Equals("hdb") Then
                    PH_HDB.Controls.Clear()
                End If

            End If

        Next

        For i = 0 To 50

            If partitions(i, 0) = "" And partitions(i, 1) = "" And partitions(i, 2) = "" And partitions(i, 3) = "" Then
                Exit For
            Else

                Dim NewTextBox As New TextBox
                Dim NewTextBoxSize As New TextBox
                Dim NewSelectBox As New DropDownList
                Dim NewSelectBoxHD As New DropDownList
                Dim update As New Button
                Dim remove As New Button

                If partitions(i, 3).Equals("hda") Then

                    'Mount texbox instellen
                    NewTextBox.ID = "Mount" & i
                    NewTextBox.CssClass = "field"
                    NewTextBox.Text = partitions(i, 0)

                    'Filesystem selectbox instellen
                    NewSelectBox.ID = "FileSystem" & i
                    NewSelectBox.CssClass = "drop"
                    NewSelectBox.Items.Add("ext2")
                    NewSelectBox.Items.Add("ext3")
                    NewSelectBox.Items.Add("LVM")
                    NewSelectBox.Items.Add("RAID")
                    NewSelectBox.Items.Add("SWAP")
                    NewSelectBox.Items.Add("vfat")
                    NewSelectBox.SelectedValue = partitions(i, 1)
                    'Size texbox instellen

                    NewTextBoxSize.ID = "Size" & i
                    NewTextBoxSize.CssClass = "field"
                    NewTextBoxSize.Text = partitions(i, 2)

                    'update knop
                    update.ID = "update" & i
                    update.Text = "Update"
                    update.CssClass = "button"

                    'remove knop
                    remove.ID = "remove" & i
                    remove.Text = "Remove"
                    remove.CssClass = "button"

                    PH_HDA.Controls.Add(New LiteralControl("<tr><td class='table'>"))
                    PH_HDA.Controls.Add(NewTextBox)
                    PH_HDA.Controls.Add(New LiteralControl("&nbsp;"))
                    PH_HDA.Controls.Add(NewSelectBox)
                    PH_HDA.Controls.Add(New LiteralControl("&nbsp;"))
                    PH_HDA.Controls.Add(NewTextBoxSize)
                    PH_HDA.Controls.Add(New LiteralControl("</td>"))
                    PH_HDA.Controls.Add(New LiteralControl("<td class='table' colSpan='2' align='right'>"))
                    PH_HDA.Controls.Add(update)
                    PH_HDA.Controls.Add(New LiteralControl("&nbsp;"))
                    PH_HDA.Controls.Add(remove)
                    PH_HDA.Controls.Add(New LiteralControl("</td></tr>"))

                ElseIf partitions(i, 3).Equals("hdb") Then

                    'Mount texbox instellen
                    NewTextBox.ID = "Mount" & i
                    NewTextBox.CssClass = "field"
                    NewTextBox.Text = partitions(i, 0)

                    'Filesystem selectbox instellen
                    NewSelectBox.ID = "FileSystem" & i
                    NewSelectBox.CssClass = "drop"
                    NewSelectBox.Items.Add("ext2")
                    NewSelectBox.Items.Add("ext3")
                    NewSelectBox.Items.Add("LVM")
                    NewSelectBox.Items.Add("RAID")
                    NewSelectBox.Items.Add("swap")
                    NewSelectBox.Items.Add("vfat")
                    NewSelectBox.SelectedValue = partitions(i, 1)
                    'Size texbox instellen

                    NewTextBoxSize.ID = "Size" & i
                    NewTextBoxSize.CssClass = "field"
                    NewTextBoxSize.Text = partitions(i, 2)

                    'update knop
                    update.ID = "update" & i
                    update.Text = "Update"
                    update.CssClass = "button"

                    'remove knop
                    remove.ID = "remove" & i
                    remove.Text = "Remove"
                    remove.CssClass = "button"

                    PH_HDB.Controls.Add(New LiteralControl("<tr><td class='table'>"))
                    PH_HDB.Controls.Add(NewTextBox)
                    PH_HDB.Controls.Add(New LiteralControl("&nbsp;"))
                    PH_HDB.Controls.Add(NewSelectBox)
                    PH_HDB.Controls.Add(New LiteralControl("&nbsp;"))
                    PH_HDB.Controls.Add(NewTextBoxSize)
                    PH_HDB.Controls.Add(New LiteralControl("</td>"))
                    PH_HDB.Controls.Add(New LiteralControl("<td class='table' colSpan='2' align='right'>"))
                    PH_HDB.Controls.Add(update)
                    PH_HDB.Controls.Add(New LiteralControl("&nbsp;"))
                    PH_HDB.Controls.Add(remove)
                    PH_HDB.Controls.Add(New LiteralControl("</td></tr>"))

                End If

            End If

        Next
    End Sub
So no basicly what this does is create a couple of new objects on the webform. But when it creates a new set of object it doesn't places them below the other ones, it just replaces the objects with the previous created objects....

How can this be? Does anyone knows how to manage this?
0
r3n3gad3
7/13/2006 6:39:58 PM
asp.net.web-forms 93655 articles. 5 followers. Follow

1 Replies
412 Views

Similar Articles

[PageSpeed] 8

nobody?
0
r3n3gad3
7/15/2006 9:33:15 AM
Reply:

Similar Artilces:

Implementing .Net Form into an APS.net web form, can this be done
I am new here, but have been searching for a while, and may not have the correct lingo to find what I am looking for.  I am tasked with implementing a .exe application that was writen vb6 then converted to .net into a new website my team is developing. The idea is to put each of the 3 different forms in this .exe application of 3 different .aspx pages. I have attempted multiple things to get this into the page and even started to just rewrite it as an ASP.net web form, but even then I can't reuse any of the code since the System.Web.UI.Page doesn't inherit the sa...

Dynamic Generation of Web Forms in C#.net
I am new to c# and vs.net studio as such and am seekin help for my project. It deals with generating webforms at runtime by takin in inputs from the user. The user will input no. of webfroms to be generated and all the attributes he want in them. I have got the datamodel right for this where all the info by the user is stored in sql server database. During runtime my application should read it from that database and based upon that generated these .aspx forms which can be posted online for use. I think it would help if you explained what the application would accomplish. It sounds like yo...

Acessing variables,arrays, objects and functions from javascript to VB .NET Web Forms
I have a textbox where user can put data.I store data into an array .I did this with java script.now i want to acess the array from the Codebehind  in vb.net web pages.here is the codefunction MakeArray( n ) { if( n <= 0 ) { this.length = 0; return this; } this.length = n; for( var i = 1; i <= n; i++ ) { this[ i ] = 0; } return this; } var Form1 = new MakeArray( 25 ); var index = 0; var cmmnd = 1; function f_store( sTR ) { var i; if( index >= Form1.length ) { for( i = 1; i < Form1.length; i++ ) Form1[i-1] = Form1; index = Form1.length - 1; } Form1[ index ] = cmmnd + ":" + sT...

windows forms in vb .net into web forms
we are creating a database driven website as part of our project. currently we have forms connecting to the database created in visual basic. these windows forms we need to convert into web forms which are asp .net compatible. can u give me an answer or show me a way. Hi, because of the difference in nature between web and win applications you'll need to reimplement at least the UI part. If you have a multitiered application in which the busines logic and data access are in different parts/assemblies you can reuse them. Grz, Kris.Read my blog. Handy Firefox plugins for web developers.Wor...

.Net Web Form & Web Service Deployment
Hi all I have written some test web services and some web form applications and deployed them to my IIS. That's fine but I now want to deploy them to my real IIS server. I have created an msi for each but the problem is I seem to only be able to deploy to the default web site. Our default web site is turned off and instead we use several other sites. Does anybody happen to if Powerbuilder 11 supports non default web sites? If not do I need to hack the msi and if so can anybody suggest a suitable tool. I have Orca but it's not very friendly. Unless of course I knew exactly w...

problem with dynamic array of dynamic array
var a:array of array of integer; begin setlength(a,2); setlength(a[0],1); setlength(a[1],2); a[0,0]:=1; //it is ok a[0,1]:=2; //it is not ok in my understanding a[0,1]:=2 is not ok because a[0] has only one element as i declared setlength(a[0],1) so i dont understand why this code exemple is compiled and run just fine ? > {quote:title=Yossi Rozenberg wrote:}{quote} > in my understanding a[0,1]:=2 is not ok because a[0] has only one element as i declared setlength(a[0],1) so i dont understand why this code exemple is compiled and run just fine ? By default, acces...

How to Make Web Forms from other Web Forms
In putting together an ASP.NET application for a biz application, we have come to the point where there are three different types of basic forms which have, for the most part, been perfected. Now its is a matter of cloning those forms for various uses and modifying or adding code to suit the particular need. Copy and paste works OK, but there is a lot of changing of certain words, etc. Is there a way in ASP.NET to take these basic forms, turn them into classes or templates, create forms from them, then add or overwrite code? ? (Anybody who is a Vis Fox Pro programmer would know imme...

Web forms and mobile web forms
Hey everyone, I am looking to develope a web site that depending on the device connecting to it, it will display a certain page. In this case im looking to create a web and wap version of the same project. I have the Web forms version finished using ASP.NET and C# and I am wondering how to create the mobile web form and incorporate it in the project. In the project folder, can I just add a mobile web??? But what about displaying device specific pages?? Cheers -Dudach Yes, you can add mobile web forms and controls to your Web Application project. No problem. For device/br...

For interrupting.web form Resized by position of the div : if div can't dispaly all (such as only top part , then web form heithten the heght),resize the web form
Web Form Resized by position of the div : if div can't dispaly all (such as only top part , then web form heithten the heght),resize the web form ! Because of my pool English, if you can't see , I will explain more ! ThanksGambler is the real life I guess you mean when form grows it also grow parent div element. This is normal. If you want div to stay fixed size and rather clip the form and maybe show a scrollbar, look at overflow property in CSS.Thanks------------------------------------------------------------This posting is provided "AS IS" with no warranties, and confers no ...

.Net Web Forms
what is the best way to create a multi-page web insurance quote form (similar to Geico) that will insert information into a database? The examples i've seen show one form with a submit button at the bottom. I need to break this form into at least three different aspx or ascx pages. Thanks for the help. I did something similiar since I have like 7 sections to an application. The way I did it was by using the asp:panel control. When the user finished one section and clicks a button it inputs the data into the database and hides the 1st panel and shows the next one. HTH...

Dynamic web form
I'm probably going to get slated for this. I'm a ASP.NET beginner and I have been stuck on a problem for over 5 hours now. Say I have a page  mypage.aspx that receives a querystring called "no". If no=2, I want to display 2   <asp:Textbox.....> or  <input type="text"> Can anyone tell me how to do this using VB? Dim tmpBox as TextBoxFor i as integer = 1 to CInt(Request.QueryString("no"))   tmpBox = New TextBox   tmpBox.ID = "txtBox" & i   myPanel.Controls.Add(tmpBox)   End ForKe...

MOVED: problem with dynamic array of dynamic array
Moved to: embarcadero.public.delphi.language.delphi.general or: https://forums.embarcadero.com/thread.jspa?threadID=57076 -- Rudy Velthuis Rudin's Law: In a crisis that forces a choice to be made among alternative courses of action, people tend to choose the worst possible course. ...

Dynamic Web Form Help
Hi folks,I'd appreciate a point in the right direction regarding terminology (i.e., what to use) and/or some tutorial sites that show precisely what I'm asking.  I've looked and looked but only found pieces of the bigger puzzle. What I'm trying to do:I want to create a form that shows another portion of the form (on the same page) based upon user input.An Example of what I'm trying to do:This is what the form would look like initially (keep in mind that this is a bogus example to help show what functionality I'm looking for):    Which of the f...

Could PB .NET Web Form POST security Information to others web page??
This is a multi-part message in MIME format. ------=_NextPart_000_00F9_01C9C4D5.8FB45C90 Content-Type: text/plain; charset="big5" Content-Transfer-Encoding: quoted-printable Hi,=20 Have anyone came across the requesion to POST security informations from = PB .NET web form web page to other web site?? I have tried many datys, Could any kind man give me some suggessions?? thanks & Best regards Leon ------=_NextPart_000_00F9_01C9C4D5.8FB45C90 Content-Type: text/html; charset="big5" Content-Transfer-Encoding: quoted-printable <!DOCTYPE HTML P...

How to fire events in other web form from other web form ?
Suppose that I have A and B web form. I want to trigger B web form's Page_Load event from A web form. How can I do that ? Thanks in advanced WilbertWilbert Bujn Create a public method in B that call the load method : public void Load(object sender, System.EventArgs e) { Page_Load(sender, e) ; } In the page_load of A, instanciate a B object and then call the function B myB = new B() ; myB.Load() ; Quicky Thank you quicky, it works fine. WilbertWilbert Bujn...

Web resources about - Dynamic Array - asp.net.web-forms

Dynamics - Wikipedia, the free encyclopedia
Brownian dynamics , the occurrence of Langevin dynamics in the motion of particles in solution (e.g. a grain in water, as was first seen by Brown); ...

Datacenter Dynamics
Datacenterdynamics for data center information, conferences, news, videos, whitepapers and reports globally

Dynamic Chiropractic - chiropractic, news, articles, research & information for chiropractors - Find ...
Dynamic Chiropractic - chiropractic, news, articles, research & information for chiropractors - Find a Chiropractor

The colorful, dark, dynamic art of life: 2015 BioArt winners
In an embryonic mouse torso, researches closely track how the parallel paths of blood vessels (gray) and nerve cells (red) develop. Understanding ...

Playing ‘GTA V’ in a Force Dynamics motion simulator looks like a ton of fun
It's been a few weeks since I last sat down and played Grand Theft Auto V . Although it's still one of my favorite games of both this generation ...

Microsoft Dynamics CRM chief steps down
... with heavyweight Salesforce, SAP and Oracle, the head of the company's CRM division this week announced plans to step down. Microsoft Dynamics ...

The Republicans’ dynamic deception for 2016
... the media: Well, the numbers the Tax Foundation had put out is that the static cost of the plan is $3.6 trillion over 10 years, but the dynamic ...

Microsoft Dynamics AX delivers the power of the cloud to businesses
Microsoft has announced that the next release of its flagship ERP solution, Microsoft Dynamics AX, will be generally available in the first quarter ...

Master and Dynamic's MW60s are a stellar mix of style and sound
My first experience with Master &amp; Dynamic's audio gear was the time I spent with the MH40 wired headphones this summer. I noticed the company's ...

Microsoft to Float Cloud-First Dynamics AX ERP in Early 2016
Forget version numbers and year-based editions. Microsoft will break from tradition with the release early next year of the next version of its ...

Resources last updated: 12/1/2015 9:35:41 AM