Sunday, April 15, 2012

GET ALL CONTROL INSIDE FORM AND SET CONTROLS PROPERTY

Public Shared Function GetControls(ByVal form As Control) As List(Of Control)
Dim controlList = New List(Of Control)()
For Each childControl As Control In form.Controls
' Recurse child controls.
controlList.AddRange(GetControls(childControl))
controlList.Add(childControl)
Next
Return controlList
End Function


Private Sub SetControls(ByVal _controls As List(Of Control), ByRef dtControrName As DataTable)
Dim cControl As Control

For Each cControl In _controls
If (TypeOf cControl Is Button) Then

For i As Integer = 0 To dtControrName.Rows.Count - 1

If (cControl.Name = dtControrName.Rows(i)(0).ToString) Then
cControl.Enabled = True
Exit For
Else
cControl.Enabled = False
End If
Next
End If

Next cControl
End Sub


Dim controlList = New List(Of Control)()
controlList = GetControls(_form)//Parametar formname
SetControls(controlList, dtGET_FORM_PERMISSION)

Friday, April 13, 2012

Dynamic css file change

1. Create a html file

and put the codes




Dynamic css file changing







-A    A    A+
Soumen Ghosh





2. And create 3 css files with different font size and name them

"style1.css" write body { text-align: center; font-size:9px; }
"style2.css" write body { text-align: center; font-size:20px; }
"style3.css" write body { text-align: center; font-size:36px; }

Textbox eocus change on enter key press

Private Sub txtModiulname_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles txtModiulname.KeyDown
If e.KeyCode = Keys.Enter Then
Me.SelectNextControl(Me.ActiveControl, True, True, True, True)
End If
End Sub

Auto Clear Textbox Control

$(document).ready(function () {
  $('.autoclear').autoclear();
});

<form method="post">
  <label for="name">Name:</label><input type="text" id="name" name="name" title="John Smith" value="<?php echo $_POST['name']; ?>" class="autoclear"/>
  <label for="email">Email:</label><input type="text" id="email" name="email" title="your@yourdomain.com" value="<?php echo $_POST['email']; ?>" class="autoclear"/>
  <label for="about">About:</label><textarea id="about" name="about" title="Tell us a little bit about yourself..." class="autoclear"><?php echo $_POST['about']; ?>
  <input type="submit" value="Submit"/><input type="reset" value="Reset"/>
</form>