Welcome to Dream.In.Code
Getting Help is Easy!

Join 131,677 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 2,491 people online right now. Registration is fast and FREE... Join Now!




VB.NET INTERESTING PROBLEM- MOVING AVERAGE.. NEED HELP!

 
Reply to this topicStart new topic

VB.NET INTERESTING PROBLEM- MOVING AVERAGE.. NEED HELP!, VB.NET INTERESTING PROBLEM- MOVING AVERAGE..

adarshyam
post 3 Oct, 2008 - 08:11 PM
Post #1


New D.I.C Head

*
Joined: 3 Oct, 2008
Posts: 3

Hi friends,
I have an interesting problem in vb.net. And I am struggling to get a solution for this trying for the past 3days.. It’s to calculate moving average for the inputs given by the user..

The following are the steps to make it clear..
1, get 2user inputs in textbox(1st input is number is periods, 2nd is moving range)
2, after getting both the user inputs, the user will click on an input button which must dynamically generate rows for the number of periods given by the user as well as a calculate button must appear dynamically.
3, the user again inputs the values the all the dynamically generated rows and when he presses calculate button, the moving average for the given moving range must appear in another column

I have done with half way and I have attached my progress here.. I would greatly appreciate if u complete it for me.. thanks in advance


CODE

Partial Public Class _Default
    Inherits System.Web.UI.Page
  
    Protected Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        Dim TxtDyn1 As TextBox()
        Dim TxtDyn2 As TextBox()
        Dim TxtDyn3 As TextBox()
        Dim TxtDyn4 As TextBox()
        Dim numofper As Integer
      
        Try

            'to check the textbox for empty

            If Not TextBox1.Text Is String.Empty Then
                numofper = TextBox1.Text
                ReDim TxtDyn1(numofper)
                ReDim TxtDyn2(numofper)
                ReDim TxtDyn3(numofper)
                ReDim TxtDyn4(numofper)

            Else
                Exit Sub
            End If

            'To create the dynamic text box and add the controls to panel
            For i As Integer = 0 To numofper - 1
                TxtDyn1(i) = New TextBox
                Panel1.Controls.Add(TxtDyn1(i))
            Next
            For j As Integer = 0 To numofper - 1
                TxtDyn2(j) = New TextBox
                Panel2.Controls.Add(TxtDyn2(j))
            Next
            For k As Integer = 0 To numofper - 1
                TxtDyn3(k) = New TextBox
                Panel3.Controls.Add(TxtDyn3(k))
            Next
            For l As Integer = 0 To numofper - 1
                TxtDyn4(l) = New TextBox
                Panel4.Controls.Add(TxtDyn4(l))
            Next

            Dim mybutton As New Button
            mybutton.Text = "button 2"
            AddHandler mybutton.Click, AddressOf PrintMessage
            Me.Controls.Add(mybutton)

        Catch ex As Exception
            MsgBox("Enter a valid Number")
        End Try
        
    End Sub

        Private Sub PrintMessage(ByVal sender As System.Object, ByVal e As System.EventArgs)
        MsgBox("Dynamic event happened!")
    End Sub
  
  
End Class



Mod edit - Fixed code tags.
User is offlineProfile CardPM

Go to the top of the page


gbertoli3
post 15 Oct, 2008 - 08:02 PM
Post #2


DIC at Heart + Code

Group Icon
Joined: 23 Jun, 2008
Posts: 1,024



Thanked 16 times

Dream Kudos: 950
My Contributions


Please do not post ASP.NET questions in the Web Development Forum, post it in the ASP.NET Forum.

This post has been edited by gbertoli3: 16 Oct, 2008 - 05:56 AM
User is online!Profile CardPM

Go to the top of the page

PsychoCoder
post 15 Oct, 2008 - 09:46 PM
Post #3


using DIC.Core;

Group Icon
Joined: 26 Jul, 2007
Posts: 8,909



Thanked 116 times

Dream Kudos: 8450

Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, Boo.Net

My Contributions


Moved to ASP.NET smile.gif
User is online!Profile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 11/20/08 07:27AM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month