Home > DeveloperSection > Forums > numeric updown control to access with graphics properties
Madhu Mitha
Madhu Mitha

Total Post:31

Points:217
Posted on    March-08-2015 11:44 PM

 .NET VB.Net 
Ratings:


 1 Reply(s)
 701  View(s)
Rate this:
Hi,

I am developing an application on LCD font makers. I just completed an work on drawing boxes where i have to place my fonts. now I need to add numeric updown control which should help me in increasing and decreasing the rows and columns in the grid.. can anyone help me resolving my problem.

my code is

Public Class Form1
    Dim x As Integer = 16
    Dim y As Integer = 144
    Dim box(x, y) As PictureBox
#Region "Run time Load"
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        buildmap()
    End Sub
#End Region
#Region "build grid"
    Public Sub buildmap()
        For row = 0 To x
            For column = 0 To y
                drawbox(row, column)
            Next
        Next
    End Sub
#End Region
#Region "Draw"

    Public Sub drawbox(ByVal row As Integer, ByVal column As Integer)

        box(row, column) = New PictureBox
        box(row, column).Size = New Point(8, 8)
        box(row, column).BorderStyle = BorderStyle.FixedSingle
        box(row, column).BackColor = Color.White
        box(row, column).Location = New Point((box(row, column).Width * column), (box(row, column).Height * row))
        Me.Controls.Add(box(row, column))
    End Sub
#End Region

Output:


This will be my output screen where the numeric controls are used to increase and decrease the rows and column in the current form.

Thanks in advance


Pawan Shukla

Total Post:37

Points:267
Supported
Posted on    March-09-2015 3:26 AM

Try this code
Imports System
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Data
Imports System.Drawing
Imports System.Linq
Imports System.Text
Imports System.Threading.Tasks
Imports System.Windows.Forms
 
Namespace Updown
    Public partial Class Form1
     Inherits Form
        Public  Sub New()
            InitializeComponent()
        End Sub
 
        Private   Sub New_Load(ByVal sender As Object, ByVal e As EventArgs)
            Me.studentTableAdapter.Fill(Me.myDBDataSet.Student)
        End Sub
 
        Private  Sub numericUpDown1_ValueChanged(ByVal sender As Object, ByVal e As EventArgs)
            Dim item As DataGridViewColumn
            For Each item In dataGridView1.Columns
                item.Width = Integer.Parse(numericUpDown1.Value.ToString())
 
            Next
            Dim item As DataGridViewRow
            For Each item In dataGridView1.Rows
                item.Height = Integer.Parse(numericUpDown1.Value.ToString())
 
            Next
        End Sub
    End Class
End Namespace


Don't want to miss updates? Please click the below button!

Follow MindStick