“Wow !!!! Now Thus Intereeessssting” That was how i exclaimed when i saw these interesting features of the STRING class in java. All this while when i wanted to convert a character array to a string , i had to go through a loop. For example

String password = “” ;
char[] pass = this.txtPassword.getPassword();
for (int i = 0; i < pass.length; i++) {
password = password + pass[i];

But this char[] pass can easily be converted to string by just a line of code:

char[] pass = this.txtPassword.getPassword();
String password=new String(pass);

Also another interesting feature of the string class is that you can easily get the string value out of a byte array and vice versa with so much ease. check this.

byte[] array=”sdfdfd”.getBytes();
String string=new String(array);

These are not all, there are more interesting features, exploree!!!!

Fellows, enjoy the weekend



Have you wondered how to show a panel(form) as a dialog in java applications as done in .NET applications by using the form.showDialog() method?  For example, when a user selects “Add New” from a Customer combobox, the customer panel shows as a dialog for a new entry before the user can continue. If you have been searching for this, here is your stop.

We will be making use of one JDialog, and your FORMS(JPanels in this sense).

To implement this add a JDialog to your application. Declare a variable contentPane and add the constructor like the one specified below.

private Container contentPane = null;

public popupsjdialog(java.awt.Frame parent, JPanel panel, boolean modal) {
//super(parent, modal);
contentPane = this.getContentPane();
this.setSize(panel.getSize().width + 30, panel.getSize().width + 50);
panel.setLocation(10, 30);


Your are now done. Now to show any JPanel as a dialog add the following code to your event.

helpdetailpanel hd = new helpdetailpanel(helpContent);
hd.setSize(700, 700);
popupsjdialog d = new popupsjdialog(null, hd, true);

Helpdetailpanel is a Jpanel (form) you want to show as a dialog and the popupsjdialog is an instance of the Jdialog we created its constructot above.

Cheers !!!!!!!!!!!!!!!!!


You have finished developing your application using VS 2005 in Windows Vista environment and you need to deploy, just go ahead and deploy in the vista environment, you do not have to look for Windows XP before you can do this. Here are few steps to follow to deploy your application using IIS 7 .

  1. First make sure all the components of the IIS server is installed on your system. To do this, Go to Start > Control Panel >Programs and Features and the click on the "Turn Windows features on or off" on the left task pane of the window as shown below.

  2. On the windows feature dialog box that pops up, make sure the Internet Information Service node and all its child nodes are checked as shown below or else get your original Windows Vista CD, check all the nodes and install these features.

  3. To access the IIS Manager after the installation, Go to Start>Control Panel>Administrative Tools >Internet Information Services (IIS) Manager or go to run (Window Key + R) and enter "inetmgr" and you will get an interface like the one below.

  4. Now we are good to go on and deploy our ASP.Net Web Application. Navigate to the Default Web Site Node, then right click on it and choose "Add Application" from the context menu. A dialog box will pop up as shown below. The alias is the name of your website, for example if you enter Ghana, or accra , or kumasi, when accessing your website from your local computer, you will be typing "localhost/Ghana, or localhost/accra, or localhost/Kumasi"

    Click on the "Physical path:" button to browse for the website folder of your application and click on the "OK" button.

  5. A new node with the name you entered in the alias textbox will appear under the "Default Web Site" node. Select the node, and make sure your connection string, default documents are set to the required values. The picture below clarify these

  6. After making the required changes, you are done. Make sure your IIS server is running (you can check this by clicking on the "Default Web Site" node and on the right task pane, under manage web site, make sure the "star" link is disabled else click on it to start the server). Go to your browser and enter your URL, in this case "http://localhost/ghana&quot; or right click your application from IIS GUI and select browse.


Hi fellows, this post is about exporting the content of your data source (dataset, data table, data grid) into MS-Excel using VB.NET. All you need to is to read the data from your data source into a 2-dimensional array and then send the content straight to excel. With this you don’t have to be adding rows to excel one after the other.

Let’s start, we have a data table called “dsstudents” with 5 columns “IndexNo, Name, Year Group, Program, Gender”. We then declare a variable Private Students(,) As String as our 2-dimensional array. We are then ready to go (code). Note that we are using late binding to the excel objects here, thus we are not referencing the excel object at the design time but it’s done in runtime.

Below are two methods that will get the job done. Cheers!!!!

Private Sub readContent()

If Me.dsStudent.Rows.Count > 0 Then
ReDim + 2, 7)

For i As Integer = 0 To
Me.dsStudent.Rows.Count – 1

‘setting the column headers for each column

students(0, 0) = "Index No"

students(0, 1) = "Students’ Name"

students(0, 5) = "Year group"

students(0, 6) = "Program Name"

students(0, 11) = "Student Gender"

‘getting the actual content from our datasource

students(i + 2, 0) = Me.dsStudent.Rows(i)(0).ToString

students(i + 2, 1) = Me.dsStudent.Rows(i)(1).ToString

students(i + 2, 3) = Me.dsStudent.Rows(i)(2).ToString

students(i + 2, 4) = Me.dsStudent.Rows(i)(3).ToString

students(i + 2, 5) = Me.dsStudent.Rows(i)(4).ToString



End If

End Sub

The implementation of the createExcel() method

Private Sub createExcel()

Dim oExcel As Object

Dim oBook As Object

Dim oSheet As Object

‘Start a new workbook in Excel.

oExcel = CreateObject("Excel.Application")

oBook = oExcel.Workbooks.Add

‘Add headers to the worksheet on row 1.

oSheet = oBook.Worksheets(1)


‘Sending the data to Excel by specifying where to start from (cell) and the rows and ‘columns need.

oSheet.Range("B8").Resize(Me.dsStudent.Rows.Count + 2, 7).Value = Me.setudent

oExcel.visible = True

oSheet = Nothing

oBook = Nothing


oExcel = Nothing


End Sub