Saturday, 30 July 2011

Hello World - Your First Android App

Recently I was looking into the option of porting my application to android. So here is a tutorial on how to write your very first android applications.

What you need:

Java knowledge
Java SDK v6.0 or above
MotoDev (Based on Eclispe) -
Android SDK (latest) -

I also recommend reading about how the android system works, the manifest file, gui file(main) , etc.

To start out instal JDK, Android SDK and update, MotoDev studio.
Set up a AVD.  
In motoDev now create a new Project and give it a appropiate name.

You will notice that the an Android application is based on the Activity class, and always reference to

Change the code in activity to corospond with the following:
import android.widget.TextView;

public void onCreate(Bundle savedInstanceState) 
         TextView tv = new TextView(this);
       tv.setText("Hello, Android");
The enlarged code is the code changed or added.
The onCreate() method is used to start your activity.
In android objects is referred to views. 
TextView will be the equvalint to an Label in .net programming or swing.
Now Run the application.

Thursday, 14 July 2011

Dynamic Create Controls on Runtime

Here is my quick guide on how to generate ImageHolder Buttons on runtime. This is perfect and works nice with inventory systems or payroll applications.(ID picture of employee)

First of all create a new project, drag a panel onto your form.
Double click on your form to open up the Form_Load() method and Return to design view.

Wednesday, 13 July 2011

Paste Excel Data Into DataGrid in

How to paste excel clipboard data in datagrid:

Private Sub PasteClipboard()

        Dim s As String

            s = Clipboard.GetText()
            Dim i, ii As Integer

            Dim tArr() As String = s.Split(ControlChars.NewLine)
            Dim arT() As String
            Dim cc, iRow, iCol As Integer

            iRow = DataGridView1.SelectedCells(0).RowIndex
            iCol = DataGridView1.SelectedCells(0).ColumnIndex
            For i = 0 To tArr.Length - 1
                If tArr(i) <> "" Then
                    arT = tArr(i).Split(vbTab)
                    cc = iCol
                    For ii = 0 To arT.Length - 1
                       If cc > DataGridView1.ColumnCount - 1 Then Exit For
                       If iRow > DataGridView1.Rows.Count - 1 Then Exit Sub
                        With DataGridView1.Item(cc, iRow)
                            .Value = arT(ii).TrimStart

                        End With
                        cc = cc + 1
                    iRow = iRow + 1
                End If


        Catch ex As Exception
            MsgBox("Please redo Copy and Click on cell")
        End Try
    End Sub

Just change the value of DataGridView1 to the objectname of your DataGrid. This can paste rows and columns.