Input  / Textbox help
Input  / Textbox help
Input  / Textbox help
Input  / Textbox help
Input  / Textbox help
Input  / Textbox help Input  / Textbox help Input  / Textbox help Input  / Textbox help Input  / Textbox help Input  / Textbox help Input  / Textbox help Input  / Textbox help
Input  / Textbox help Input  / Textbox help
Input  / Textbox help
Go Back  Xtreme Visual Basic Talk > > > Input / Textbox help


Reply
 
Thread Tools Display Modes
  #1  
Old 09-08-2016, 08:04 PM
supercrewed supercrewed is offline
Centurion
 
Join Date: Feb 2004
Posts: 152
Default Input / Textbox help


I have three text boxes I use for inputs, and a total of 36 text boxes to show the inputs as they are entered. I there a way to input the data to the three text boxes, and the only have one code routine, that will index to each of the other text boxes to show what was entered???
A sample is below, as you can see there are the three input text boxes;
CDbl(.INPUT_1.Text)
CDbl(.INPUT_2.Text)
CDbl(.INPUT_3.Text)

and then there are the text boxes I use to show the inputs as the numbers are entered, in total there are twelve sets of three, and one set of input boxes.

Code:
Public Sub Click_Counter()
		
		i = Part_Count
        MAIN_FORM.PART_COUNT_BUTTON.Text = "PART " & Format (Part_Count, "0")
        With MAIN_FORM

            If i = 1 Then
                .PART_1_P_DIM.Text = FOUR_PLC(CDbl(.INPUT_1.Text))
                .PART_1_DIE_LAND.Text = FOUR_PLC(CDbl(.INPUT_2.Text))
                .PART_1_OAL.Text = FOUR_PLC(CDbl(.INPUT_3.Text))

            ElseIf i = 2 Then
                .PART_2_P_DIM.Text = FOUR_PLC(CDbl(.INPUT_1.Text))
                .PART_2_DIE_LAND.Text = FOUR_PLC(CDbl(.INPUT_2.Text))
                .PART_2_OAL.Text = FOUR_PLC(CDbl(.INPUT_3.Text))

            ElseIf i = 3 Then
                .PART_3_P_DIM.Text = FOUR_PLC(CDbl(.INPUT_1.Text))
                .PART_3_DIE_LAND.Text = FOUR_PLC(CDbl(.INPUT_2.Text))
                .PART_3_OAL.Text = FOUR_PLC(CDbl(.INPUT_3.Text))

            ElseIf i = 4 Then
                .PART_4_P_DIM.Text = FOUR_PLC(CDbl(.INPUT_1.Text))
                .PART_4_DIE_LAND.Text = FOUR_PLC(CDbl(.INPUT_2.Text))
                .PART_4_OAL.Text = FOUR_PLC(CDbl(.INPUT_3.Text))

'I was thinking I could use something like this, but I tried to put something together, but no good, Any ideas???

      For Each c As Control In Me.Controls
            If c.GetType Is GetType(TextBox) And Mid(c.Name, 1, 5) = "PART_" & cstr(part_Count) & "_P_DIM") Then
                c.Text = FOUR_PLC(CDbl(.INPUT_1.Text))

            End If
        Next

What do you think, it works as is, but I'd like to shorten the code, since I need to increase the part input count to 24.
Reply With Quote
  #2  
Old 09-08-2016, 08:55 PM
supercrewed supercrewed is offline
Centurion
 
Join Date: Feb 2004
Posts: 152
Default

Never mind, I got it to go!!!

Code:
	Public Sub Click_Counter()
		
		i = Part_Count
        MAIN_FORM.PART_COUNT_BUTTON.Text = "PART " & Format(Part_Count, "0")
        With MAIN_FORM
            For Each c As Control In .Controls
                If c.GetType Is GetType(TextBox) And Mid(c.Name, 1) = "PART_" & CStr(i) & "_P_DIM" Then
                    c.Text = FOUR_PLC(CDbl(.INPUT_1.Text))
                End If
            Next

            For Each c As Control In .Controls
                If c.GetType Is GetType(TextBox) And Mid(c.Name, 1) = "PART_" & CStr(i) & "_DIE_LAND" Then
                    c.Text = FOUR_PLC(CDbl(.INPUT_2.Text))
                End If
            Next

            For Each c As Control In .Controls
                If c.GetType Is GetType(TextBox) And Mid(c.Name, 1) = "PART_" & CStr(i) & "_OAL" Then
                    c.Text = FOUR_PLC(CDbl(.INPUT_3.Text))
                End If
            Next

        End With

	End Sub
Reply With Quote
Reply

Tags
boxes, text, four_plccdbl.input_1.text, input, four_plccdbl.input_2.text, four_plccdbl.input_3.text, entered, elseif, inputs, total, part_count, code, .part_4_p_dim.text, thinking, .part_4_die_land.text, .part_4_oal.text, c.text, shorten, count, increase, me.controls, c.gettype, control, ideas, gettypetextbox


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Input  / Textbox help
Input  / Textbox help
Input  / Textbox help Input  / Textbox help
Input  / Textbox help
Input  / Textbox help
Input  / Textbox help Input  / Textbox help Input  / Textbox help Input  / Textbox help Input  / Textbox help Input  / Textbox help Input  / Textbox help
Input  / Textbox help
Input  / Textbox help
 
Input  / Textbox help
Input  / Textbox help
 
-->