-
Jun 24th, 2019, 05:03 PM
#1
Thread Starter
Lively Member
WidowsForm scrollbar
Dear all,
I'm developing an application on VS2019, I have in there 13 windowsforms, and I have a problem with a couple of them.
The issue I'm having is that when I launch them in debug mode all the controls in it are falling down at the bottom of the form. The form has the property AutoScroll set on "True", but also the others for which this such of issue is not showing up.
Any clue on how I can get rid of it?
Thanks,
A.
-
Jun 24th, 2019, 06:15 PM
#2
Re: WidowsForm scrollbar
You could start by showing us something that we could examine to determine what is wrong with it. Your question amounts to "I have forms, some don't work, what's wrong".
-
Jun 25th, 2019, 01:00 AM
#3
Thread Starter
Lively Member
Re: WidowsForm scrollbar
Dear jmcilhinney,
Here you go! In attachment what is happening. Please note that before launching the debug mode, the location of the textbox that you see in the picture, was 183,10, now it is 183,7400. The same for all the other controls I have in the windowsform.
Thanks,
A.
-
Jun 25th, 2019, 03:39 AM
#4
Re: WidowsForm scrollbar
Obviously that's not normal so either there's something in your project that is doing it or there's something corrupt on your system. As it stands, we can't examine either to confirm it as the cause or rule it out. We're not magic. We need something to work with.
-
Jun 25th, 2019, 03:57 AM
#5
Thread Starter
Lively Member
Re: WidowsForm scrollbar
Dear jmcilhinney,
that this is not normal is clear, otherwise why should I have written in the forum? For sure I'm not magic but even not so stupid...
Based on your experience and huge knowledge (which is the reason why I'm writing to the forum, as humbly I know "to not know"), where could I check to make for example comparison with other windowsforms that in fact are working fine?
I can report for sure two elements that maybe could help you with your suggestion:
- please consider that I'm using a sort of "custom" panel for which I report here below the code that I inserted in the related Class;
- Recently I had to re-create the form as all the custom panels - which I inserted from as per above point - appeared suddenly empty. When I created a new textbox, it has been created like "Textbox177" - so it seemed that all the other textboxes that were previously in the form have not been deleted.
Code:
Public Class MyPanel
Inherits System.Windows.Forms.Panel
Public Sub New()
Me.BorderStyle = Windows.Forms.BorderStyle.None
End Sub
Private bWidth As Integer
Public Property BorderWidth() As Integer
Get
Return Me.bWidth
End Get
Set(ByVal value As Integer)
Me.bWidth = Math.Abs(value)
Me.Refresh()
End Set
End Property
Private bColor As Color
Public Property BorderColor() As Color
Get
Return Me.bColor
End Get
Set(ByVal value As Color)
Me.bColor = value
Me.Refresh()
End Set
End Property
Public Overridable Sub MyPanel_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
e.Graphics.DrawRectangle(New Pen(Me.bColor, Me.bWidth), Me.ClientRectangle)
End Sub
End Class
I hope to have given you some more elements. I'm almost convinced to make it again from scratch - please let me know if you agree.
Thanks for your support,
A.
-
Jun 25th, 2019, 05:02 AM
#6
Thread Starter
Lively Member
Re: WidowsForm scrollbar
Dear jmcilhinney,
just to add one additional point related to what written above, if I check in fact the components in the Solution Explorer panel I still can see all the textboxes, but I cannot see them (to delete them) in the Designer...
Thanks,
A.
-
Jul 4th, 2019, 04:42 AM
#7
Thread Starter
Lively Member
Re: WidowsForm scrollbar
Dear all,
picking up again this thread as:
- I've build again the form with all the controls in it;
- Unfortunately I've verified that even in the new form the same issue happens;
- I've completed the code in it, test it and I guess I have been able to identify the piece of code which is actually moving all the stuff in the Form.
In particular, the form should allow the user to input data or to load them from Excel (Button 1).
From my tests I've been able to identify that the program is moving the items if I remove comments from the code below:
Code:
Imports Microsoft.Office.Interop
Imports Microsoft.Office.Interop.Excel
Public Class Form14
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim xlAppP As Excel.Application
Dim xlWBP As Excel.Workbook
Dim xlWSP As Excel.Worksheet
Dim fNameP As String
If OpenFileDialog1.ShowDialog = DialogResult.OK Then
TextBox1.Text = OpenFileDialog1.FileName
End If
fNameP = TextBox1.Text
xlAppP = New Excel.Application
Try
xlWBP = xlAppP.Workbooks.Open(fNameP, [ReadOnly]:=True)
Catch ex As Exception
Stop
End Try
xlWSP = xlWBP.Worksheets(1)
xlAppP.Visible = False
TextBox2.Text = xlWSP.Range("d6").Value
TextBox3.Text = xlWSP.Range("h6").Value
TextBox4.Text = xlWSP.Range("d10").Value
TextBox5.Text = xlWSP.Range("d11").Value
TextBox6.Text = xlWSP.Range("d14").Value
ComboBox1.Text = xlWSP.Range("d13").Value.ToString()
DateTimePicker1.Value = xlWSP.Range("d12").Value
TextBox7.Text = xlWSP.Range("d16").Value
TextBox8.Text = xlWSP.Range("d15").Value
ComboBox2.Text = xlWSP.Range("c21").Value.ToString()
ComboBox3.Text = xlWSP.Range("l21").Value.ToString()
TextBox9.Text = xlWSP.Range("g23").Value
TextBox10.Text = xlWSP.Range("g24").Value
TextBox11.Text = xlWSP.Range("g25").Value
TextBox12.Text = xlWSP.Range("g26").Value
TextBox13.Text = xlWSP.Range("g27").Value
TextBox14.Text = xlWSP.Range("g28").Value
TextBox17.Text = xlWSP.Range("g29").Value
TextBox16.Text = xlWSP.Range("g30").Value
TextBox15.Text = xlWSP.Range("g31").Value
TextBox18.Text = xlWSP.Range("g32").Value
TextBox19.Text = xlWSP.Range("g33").Value
TextBox20.Text = xlWSP.Range("g34").Value
TextBox21.Text = xlWSP.Range("g35").Value
TextBox22.Text = xlWSP.Range("g36").Value
TextBox23.Text = xlWSP.Range("g37").Value
TextBox24.Text = xlWSP.Range("g38").Value
TextBox25.Text = xlWSP.Range("g39").Value
TextBox26.Text = xlWSP.Range("g40").Value
TextBox27.Text = xlWSP.Range("g41").Value
TextBox28.Text = xlWSP.Range("g42").Value
TextBox29.Text = xlWSP.Range("g43").Value
TextBox30.Text = xlWSP.Range("g44").Value
TextBox31.Text = xlWSP.Range("g45").Value
TextBox32.Text = xlWSP.Range("g46").Value
TextBox33.Text = xlWSP.Range("g47").Value
TextBox83.Text = xlWSP.Range("f23").Value
TextBox82.Text = xlWSP.Range("f24").Value
TextBox81.Text = xlWSP.Range("f25").Value
TextBox78.Text = xlWSP.Range("f26").Value
TextBox79.Text = xlWSP.Range("f27").Value
TextBox80.Text = xlWSP.Range("f28").Value
TextBox74.Text = xlWSP.Range("f29").Value
TextBox73.Text = xlWSP.Range("f30").Value
TextBox72.Text = xlWSP.Range("f31").Value
TextBox75.Text = xlWSP.Range("f32").Value
TextBox76.Text = xlWSP.Range("f33").Value
TextBox77.Text = xlWSP.Range("f34").Value
TextBox60.Text = xlWSP.Range("f35").Value
TextBox61.Text = xlWSP.Range("f36").Value
TextBox62.Text = xlWSP.Range("f37").Value
TextBox63.Text = xlWSP.Range("f38").Value
TextBox64.Text = xlWSP.Range("f39").Value
TextBox65.Text = xlWSP.Range("f40").Value
TextBox66.Text = xlWSP.Range("f41").Value
TextBox67.Text = xlWSP.Range("f42").Value
TextBox68.Text = xlWSP.Range("f43").Value
TextBox69.Text = xlWSP.Range("f44").Value
TextBox70.Text = xlWSP.Range("f45").Value
TextBox71.Text = xlWSP.Range("f46").Value
TextBox59.Text = xlWSP.Range("f47").Value
TextBox110.Text = xlWSP.Range("f48").Value
TextBox58.Text = xlWSP.Range("j23").Value
TextBox57.Text = xlWSP.Range("j24").Value
TextBox56.Text = xlWSP.Range("j25").Value
TextBox53.Text = xlWSP.Range("j26").Value
TextBox54.Text = xlWSP.Range("j27").Value
TextBox55.Text = xlWSP.Range("j28").Value
TextBox49.Text = xlWSP.Range("j29").Value
TextBox48.Text = xlWSP.Range("j30").Value
TextBox47.Text = xlWSP.Range("j31").Value
TextBox50.Text = xlWSP.Range("j32").Value
TextBox51.Text = xlWSP.Range("j33").Value
TextBox52.Text = xlWSP.Range("j34").Value
TextBox35.Text = xlWSP.Range("j35").Value
TextBox36.Text = xlWSP.Range("j36").Value
TextBox37.Text = xlWSP.Range("j37").Value
TextBox38.Text = xlWSP.Range("j38").Value
TextBox39.Text = xlWSP.Range("j39").Value
TextBox40.Text = xlWSP.Range("j40").Value
TextBox41.Text = xlWSP.Range("j41").Value
TextBox42.Text = xlWSP.Range("j42").Value
TextBox43.Text = xlWSP.Range("j43").Value
TextBox44.Text = xlWSP.Range("j44").Value
TextBox45.Text = xlWSP.Range("j45").Value
TextBox46.Text = xlWSP.Range("j46").Value
TextBox34.Text = xlWSP.Range("j47").Value
TextBox108.Text = xlWSP.Range("l23").Value
TextBox107.Text = xlWSP.Range("l24").Value
TextBox106.Text = xlWSP.Range("l25").Value
TextBox103.Text = xlWSP.Range("l26").Value
TextBox104.Text = xlWSP.Range("l27").Value
TextBox105.Text = xlWSP.Range("l28").Value
TextBox99.Text = xlWSP.Range("l29").Value
TextBox98.Text = xlWSP.Range("l30").Value
TextBox97.Text = xlWSP.Range("l31").Value
TextBox100.Text = xlWSP.Range("l32").Value
TextBox101.Text = xlWSP.Range("l33").Value
TextBox102.Text = xlWSP.Range("l34").Value
TextBox85.Text = xlWSP.Range("l35").Value
TextBox86.Text = xlWSP.Range("l36").Value
TextBox87.Text = xlWSP.Range("l37").Value
TextBox88.Text = xlWSP.Range("l38").Value
TextBox89.Text = xlWSP.Range("l39").Value
TextBox90.Text = xlWSP.Range("l40").Value
TextBox91.Text = xlWSP.Range("l41").Value
TextBox92.Text = xlWSP.Range("l42").Value
TextBox93.Text = xlWSP.Range("l43").Value
TextBox94.Text = xlWSP.Range("l44").Value
TextBox95.Text = xlWSP.Range("l45").Value
TextBox96.Text = xlWSP.Range("l46").Value
TextBox84.Text = xlWSP.Range("l47").Value
TextBox109.Text = xlWSP.Range("j48").Value
Dim loadarrayGMarcC(,) As Object = xlWSP.Range("C24:C29").Value
Dim loadarrayMMarcC(,) As Object = xlWSP.Range("E24:E29").Value
Try
For i = 1 To 5
If loadarrayGMarcC(i, 1) IsNot Nothing Then
DataGridView1.Rows.Add()
DataGridView1.Rows(i - 1).Cells(0).Value = loadarrayGMarcC(i, 1)
DataGridView1.Rows(i - 1).Cells(1).Value = loadarrayMMarcC(i, 1)
End If
Next
Catch ex As Exception
MessageBox.Show(ex.ToString)
End Try
Dim loadarrayGMarcT(,) As Object = xlWSP.Range("M24:M29").Value
Dim loadarrayMMarcT(,) As Object = xlWSP.Range("O24:O29").Value
Try
For i = 1 To 5
If loadarrayGMarcT(i, 1) IsNot Nothing Then
DataGridView2.Rows.Add()
DataGridView2.Rows(i - 1).Cells(0).Value = loadarrayGMarcT(i, 1)
DataGridView2.Rows(i - 1).Cells(1).Value = loadarrayMMarcT(i, 1)
End If
Next
Catch ex As Exception
MessageBox.Show(ex.ToString)
End Try
Dim loadarrayGEntraC(,) As Object = xlWSP.Range("A31:A37").Value
Dim loadarrayGEsceC(,) As Object = xlWSP.Range("C31:C37").Value
Dim loadarrayMSostC(,) As Object = xlWSP.Range("E31:E37").Value
Try
For i = 1 To 7
If loadarrayGEntraC(i, 1) IsNot Nothing Then
DataGridView3.Rows.Add()
DataGridView3.Rows(i - 1).Cells(0).Value = loadarrayGEntraC(i, 1)
DataGridView3.Rows(i - 1).Cells(0).Value = loadarrayGEsceC(i, 1)
DataGridView3.Rows(i - 1).Cells(1).Value = loadarrayMSostC(i, 1)
End If
Next
Catch ex As Exception
MessageBox.Show(ex.ToString)
End Try
Dim loadarrayGEntraT(,) As Object = xlWSP.Range("M31:M37").Value
Dim loadarrayGEsceT(,) As Object = xlWSP.Range("O31:O37").Value
Dim loadarrayMSostT(,) As Object = xlWSP.Range("Q31:Q37").Value
Try
For i = 1 To 7
If loadarrayGEntraT(i, 1) IsNot Nothing Then
DataGridView4.Rows.Add()
DataGridView4.Rows(i - 1).Cells(0).Value = loadarrayGEntraT(i, 1)
DataGridView4.Rows(i - 1).Cells(0).Value = loadarrayGEsceT(i, 1)
DataGridView4.Rows(i - 1).Cells(1).Value = loadarrayMSostT(i, 1)
End If
Next
Catch ex As Exception
MessageBox.Show(ex.ToString)
End Try
Dim loadarrayGAmmC(,) As Object = xlWSP.Range("C39:C44").Value
Dim loadarrayMAmmC(,) As Object = xlWSP.Range("E39:E44").Value
Try
For i = 1 To 6
If loadarrayGAmmC(i, 1) IsNot Nothing Then
DataGridView5.Rows.Add()
DataGridView5.Rows(i - 1).Cells(0).Value = loadarrayGAmmC(i, 1)
DataGridView5.Rows(i - 1).Cells(1).Value = loadarrayMAmmC(i, 1)
End If
Next
Catch ex As Exception
MessageBox.Show(ex.ToString)
End Try
Dim loadarrayGAmmT(,) As Object = xlWSP.Range("M39:M44").Value
Dim loadarrayMAmmT(,) As Object = xlWSP.Range("O39:O44").Value
Try
For i = 1 To 6
If loadarrayGAmmT(i, 1) IsNot Nothing Then
DataGridView6.Rows.Add()
DataGridView6.Rows(i - 1).Cells(0).Value = loadarrayGAmmT(i, 1)
DataGridView6.Rows(i - 1).Cells(1).Value = loadarrayMAmmT(i, 1)
End If
Next
Catch ex As Exception
MessageBox.Show(ex.ToString)
End Try
Dim loadarrayGEspC(,) As Object = xlWSP.Range("C46:C51").Value
Dim loadarrayMEspC(,) As Object = xlWSP.Range("E46:E51").Value
Try
For i = 1 To 6
If loadarrayGEspC(i, 1) IsNot Nothing Then
DataGridView7.Rows.Add()
DataGridView7.Rows(i - 1).Cells(0).Value = loadarrayGEspC(i, 1)
DataGridView7.Rows(i - 1).Cells(1).Value = loadarrayMEspC(i, 1)
End If
Next
Catch ex As Exception
MessageBox.Show(ex.ToString)
End Try
Dim loadarrayGEspT(,) As Object = xlWSP.Range("M46:M51").Value
Dim loadarrayMEspT(,) As Object = xlWSP.Range("O46:O51").Value
Try
For i = 1 To 6
If loadarrayGEspT(i, 1) IsNot Nothing Then
DataGridView8.Rows.Add()
DataGridView8.Rows(i - 1).Cells(0).Value = loadarrayGEspT(i, 1)
DataGridView8.Rows(i - 1).Cells(1).Value = loadarrayMEspT(i, 1)
End If
Next
Catch ex As Exception
MessageBox.Show(ex.ToString)
End Try
'TextBox310.Text = xlWSP.Range("i55").Value
'TextBox308.Text = xlWSP.Range("i58").Value
'ComboBox105.Text = xlWSP.Range("i59").Value
'ComboBox104.Text = xlWSP.Range("i60").Value
'ComboBox103.Text = xlWSP.Range("i61").Value
'ComboBox102.Text = xlWSP.Range("i62").Value
'ComboBox101.Text = xlWSP.Range("i63").Value
'ComboBox100.Text = xlWSP.Range("i64").Value
'ComboBox99.Text = xlWSP.Range("i65").Value
'TextBox307.Text = xlWSP.Range("i66").Value
'TextBox306.Text = xlWSP.Range("i69").Value
'ComboBox98.Text = xlWSP.Range("i72").Value
'TextBox135.Text = xlWSP.Range("f95").Value
'TextBox136.Text = xlWSP.Range("h95").Value
'TextBox140.Text = xlWSP.Range("j95").Value
'TextBox141.Text = xlWSP.Range("l95").Value
'TextBox145.Text = xlWSP.Range("f96").Value
'TextBox144.Text = xlWSP.Range("h96").Value
'TextBox143.Text = xlWSP.Range("j96").Value
'TextBox142.Text = xlWSP.Range("l96").Value
'TextBox149.Text = xlWSP.Range("f97").Value
'TextBox148.Text = xlWSP.Range("h97").Value
'TextBox147.Text = xlWSP.Range("j97").Value
'TextBox146.Text = xlWSP.Range("l97").Value
'TextBox153.Text = xlWSP.Range("f98").Value
'TextBox152.Text = xlWSP.Range("h98").Value
'TextBox151.Text = xlWSP.Range("j98").Value
'TextBox150.Text = xlWSP.Range("l98").Value
'TextBox157.Text = xlWSP.Range("f99").Value
'TextBox156.Text = xlWSP.Range("h99").Value
'TextBox155.Text = xlWSP.Range("j99").Value
'TextBox154.Text = xlWSP.Range("l99").Value
'TextBox161.Text = xlWSP.Range("f100").Value
'TextBox160.Text = xlWSP.Range("h100").Value
'TextBox159.Text = xlWSP.Range("j100").Value
'TextBox158.Text = xlWSP.Range("l100").Value
'TextBox303.Text = xlWSP.Range("c113").Value
'TextBox304.Text = xlWSP.Range("e113").Value
'TextBox305.Text = xlWSP.Range("g113").Value
'TextBox300.Text = xlWSP.Range("i113").Value
'TextBox301.Text = xlWSP.Range("k113").Value
'TextBox302.Text = xlWSP.Range("m113").Value
'TextBox297.Text = xlWSP.Range("u113").Value
'TextBox298.Text = xlWSP.Range("w113").Value
'TextBox299.Text = xlWSP.Range("y113").Value
'TextBox294.Text = xlWSP.Range("u114").Value
'TextBox295.Text = xlWSP.Range("w114").Value
'TextBox296.Text = xlWSP.Range("y114").Value
'TextBox291.Text = xlWSP.Range("o114").Value
'TextBox292.Text = xlWSP.Range("q114").Value
'TextBox293.Text = xlWSP.Range("s114").Value
'TextBox288.Text = xlWSP.Range("u115").Value
'TextBox289.Text = xlWSP.Range("w115").Value
'TextBox290.Text = xlWSP.Range("y115").Value
'TextBox285.Text = xlWSP.Range("o115").Value
'TextBox286.Text = xlWSP.Range("q115").Value
'TextBox287.Text = xlWSP.Range("s115").Value
'TextBox282.Text = xlWSP.Range("y116").Value
'TextBox283.Text = xlWSP.Range("w116").Value
'TextBox284.Text = xlWSP.Range("u116").Value
'TextBox139.Text = xlWSP.Range("i75").Value
'TextBox138.Text = xlWSP.Range("i78").Value
'ComboBox36.Text = xlWSP.Range("i81").Value
'ComboBox35.Text = xlWSP.Range("i82").Value
'ComboBox34.Text = xlWSP.Range("i83").Value
'ComboBox33.Text = xlWSP.Range("i84").Value
'TextBox137.Text = xlWSP.Range("i85").Value
'ComboBox30.Text = xlWSP.Range("i88").Value
'ComboBox29.Text = xlWSP.Range("i89").Value
'TextBox162.Text = xlWSP.Range("f102").Value
'TextBox163.Text = xlWSP.Range("h102").Value
'TextBox164.Text = xlWSP.Range("j102").Value
'TextBox165.Text = xlWSP.Range("l102").Value
'TextBox169.Text = xlWSP.Range("f103").Value
'TextBox168.Text = xlWSP.Range("h103").Value
'TextBox167.Text = xlWSP.Range("j103").Value
'TextBox166.Text = xlWSP.Range("l103").Value
'TextBox173.Text = xlWSP.Range("f104").Value
'TextBox172.Text = xlWSP.Range("h104").Value
'TextBox171.Text = xlWSP.Range("j104").Value
'TextBox170.Text = xlWSP.Range("l104").Value
'TextBox177.Text = xlWSP.Range("f105").Value
'TextBox176.Text = xlWSP.Range("h105").Value
'TextBox175.Text = xlWSP.Range("j105").Value
'TextBox174.Text = xlWSP.Range("l105").Value
'TextBox181.Text = xlWSP.Range("f106").Value
'TextBox180.Text = xlWSP.Range("h106").Value
'TextBox179.Text = xlWSP.Range("j106").Value
'TextBox178.Text = xlWSP.Range("l106").Value
'TextBox185.Text = xlWSP.Range("f107").Value
'TextBox184.Text = xlWSP.Range("h107").Value
'TextBox183.Text = xlWSP.Range("j107").Value
'TextBox182.Text = xlWSP.Range("l107").Value
'TextBox132.Text = xlWSP.Range("c117").Value
'TextBox133.Text = xlWSP.Range("e117").Value
'TextBox134.Text = xlWSP.Range("g117").Value
'TextBox129.Text = xlWSP.Range("i117").Value
'TextBox130.Text = xlWSP.Range("k117").Value
'TextBox131.Text = xlWSP.Range("m117").Value
'TextBox126.Text = xlWSP.Range("u117").Value
'TextBox127.Text = xlWSP.Range("w117").Value
'TextBox128.Text = xlWSP.Range("y117").Value
'TextBox123.Text = xlWSP.Range("y118").Value
'TextBox124.Text = xlWSP.Range("w118").Value
'TextBox125.Text = xlWSP.Range("u118").Value
'TextBox120.Text = xlWSP.Range("s118").Value
'TextBox121.Text = xlWSP.Range("q118").Value
'TextBox122.Text = xlWSP.Range("o118").Value
'TextBox117.Text = xlWSP.Range("y119").Value
'TextBox118.Text = xlWSP.Range("w119").Value
'TextBox119.Text = xlWSP.Range("u119").Value
'TextBox114.Text = xlWSP.Range("s119").Value
'TextBox115.Text = xlWSP.Range("q119").Value
'TextBox116.Text = xlWSP.Range("o119").Value
'TextBox111.Text = xlWSP.Range("c120").Value
'TextBox112.Text = xlWSP.Range("e120").Value
'TextBox113.Text = xlWSP.Range("g120").Value
'TextBox311.Text = xlWSP.Range("u121").Value
'TextBox312.Text = xlWSP.Range("w121").Value
'TextBox313.Text = xlWSP.Range("y121").Value
xlWBP.Close(False) 'won't try to save workbook
xlWSP = Nothing
xlWBP = Nothing
xlAppP = Nothing
End Sub
Please consider that all the controls are included in 5 Panels.
Please help...
A.
Tags for this Thread
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
|