VB.Net - Make Transparent Color

VB.Net - How To Make Transparent Color  In Visual Basic.Net

transparent color in vb.net


In This VB.Net Tutorial  We Will See How To Make A Panel Background Color Transparent With RGBA Using Visual Basic.Net Programming Language.


Project Source Code:

Public Class transparent_color

    Private Sub transparent_color_Load(sender As Object, e As EventArgs) Handles MyBase.Load

        Panel1.BackColor = Color.FromArgb(100, 255, 255, 255)
        Panel2.BackColor = Color.FromArgb(150, 30, 139, 195)
        Panel3.BackColor = Color.FromArgb(150, 0, 177, 106)
        Panel4.BackColor = Color.FromArgb(150, 248, 148, 6)
        Panel5.BackColor = Color.FromArgb(150, 242, 38, 19)

    End Sub
End Class

//OutPut:

visual basic.net transparent background color




Java - Show JTable Selected Rows To Another JFrame JTable

Java - How To Display JTable Selected Rows To Another JFrame JTabel In Java

JTable Selected Rows To Another JFrame JTabel In Java



In this Java Tutorial we will see How To Get Jtable Selected Rows And Display Them In A Second Jtable In Another JFrame In Java NetBeans .




Project Source Code:


package javaapp;

import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableModel;

/**
 *
 * @author 1BestCsharp
 */
public class JFrame1 extends javax.swing.JFrame {

    /**
     * Creates new form JFrame1
     */
    public JFrame1() {
        initComponents();
    }

   
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">                          
    private void initComponents() {

        jScrollPane1 = new javax.swing.JScrollPane();
        jTable1 = new javax.swing.JTable();
        Export_Rows = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        jTable1.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {"F1", "L1", "10", "CN1"},
                {"F2", "L2", "15", "CN2"},
                {"F3", "L3", "20", "CN3"},
                {"F4", "L4", "25", "CN4"},
                {"F5", "L5", "30", "CN5"},
                {"F6", "L6", "35", "CN6"},
                {"F7", "L7", "40", "CN7"},
                {"F8", "L8", "45", "CN8"},
                {"F9", "L9", "50", "CN9"},
                {"F10", "L10", "55", "CN10"},
                {"F11", "L11", "60", "CN11"},
                {"F12", "L12", "65", "CN12"}
            },
            new String [] {
                "First Name", "Last Name", "Age", "Country"
            }
        ));
        jScrollPane1.setViewportView(jTable1);

        Export_Rows.setText("Show Selected Row In Another JFrame");
        Export_Rows.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                Export_RowsActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 379, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(79, 79, 79)
                        .addComponent(Export_Rows)))
                .addContainerGap(51, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(Export_Rows)
                .addGap(18, 18, 18)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 248, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(37, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>                        

    private void Export_RowsActionPerformed(java.awt.event.ActionEvent evt) {                                            
       
        TableModel model1 = jTable1.getModel();
        int indexs[] = jTable1.getSelectedRows();
        
        Object[] row = new Object[4];
        
        JFrame2 frm2 = new JFrame2();
        DefaultTableModel model2 = (DefaultTableModel)frm2.jTable1.getModel();
        
        for(int i = 0; i < indexs.length; i++)
        {
            row[0] = model1.getValueAt(indexs[i], 0);
            row[1] = model1.getValueAt(indexs[i], 1);
            row[2] = model1.getValueAt(indexs[i], 2);
            row[3] = model1.getValueAt(indexs[i], 3);
            
            model2.addRow(row);
        }
        
        frm2.setVisible(true);
    }                                           

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(JFrame1.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(JFrame1.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(JFrame1.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(JFrame1.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new JFrame1().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify                     
    private javax.swing.JButton Export_Rows;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JTable jTable1;
    // End of variables declaration                   
}



////// OUTPUT : 
jtable in form1

jtable in form2




VB.Net - Check If Folder Contains Files

VB.Net - How To Check If Folder Contains Files Or Folders Using Visual Basic.Net

vb.net check if directory contains files


In This VB.Net Tutorial  We Will See How To Check If A Directory Contains Files Or Other Sub Directory Using Visual Basic.Net Programming Language.


Project Source Code:

Imports System.IO

Public Class Contain_Files_And_Folder

    Private Sub ButtonCheck_Click(sender As Object, e As EventArgs) Handles ButtonCheck.Click

        Dim path As String
        path = TextBox1.Text
        Dim files() As String
        Dim folders() As String

        If Directory.Exists(path) Then

            files = Directory.GetFiles(path)
            folders = Directory.GetDirectories(path)

            Label1.Text = files.Length & " File And " & folders.Length & " Folder "


        End If


    End Sub
End Class

//OutPut:

VB.Net - Check If Folder Contains Files





VB.Net - Hide And Show Password Text

VB.Net - How To Hide And Display Password Text Using Visual Basic.Net

visual basic.net show and hide password text


In This VB.Net Tutorial  We Will See How To Show And Hide TextBox Password Text In Button Click Event Using Visual Basic.Net Programming Language.


Project Source Code:

Public Class PassShow_Hide

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

        If TextBox1.UseSystemPasswordChar = True Then

            TextBox1.UseSystemPasswordChar = False
            Button1.Text = "Hide"

        Else

            TextBox1.UseSystemPasswordChar = True
            Button1.Text = "Show"

        End If

    End Sub

' Form Load
    Private Sub PassShow_Hide_Load(sender As Object, e As EventArgs) Handles MyBase.Load

        TextBox1.UseSystemPasswordChar = True


    End Sub
End Class


//OutPut:

visual basic.net display password string text

vb.net show password string text




VB.Net - Remove File And Directory

VB.Net - How to Delete File And Folder Using Visual Basic.Net

vb.net remove file or folder


In This VB.Net Tutorial  We Will See How To Delete File Or A Folder From A Path String Using Visual Basic.Net Programming Language.


Project Source Code:

Imports System.IO

Public Class Remove_File_Folder

' remove file if exists
    Private Sub ButtonDeleteFile_Click(sender As Object, e As EventArgs) Handles ButtonDeleteFile.Click

        Dim filePath As String
        filePath = TextBoxFilePath.Text

        If File.Exists(filePath) Then

            File.Delete(filePath)

        Else

            MessageBox.Show("File Not Found")


        End If

    End Sub

' remove directory if exists
    Private Sub ButtonDeleteFolder_Click(sender As Object, e As EventArgs) Handles ButtonDeleteFolder.Click

        Dim folderPath As String
        folderPath = TextBoxFolderPath.Text

        If Directory.Exists(folderPath) Then
            'if the directory contain files
            Directory.Delete(folderPath, True)

        Else

            MessageBox.Show("Folder Not Found")


        End If

    End Sub
End Class



VB.Net - Create File And Directory

VB.Net - How To Create File And Folder Using Visual Basic.Net

VB.Net Create Directory


In This VB.Net Tutorial  We Will See How To Create File Or A Folder From A Path String If Not Already Exists Using Visual Basic.Net Programming Language.


Project Source Code:

Imports System.IO

Public Class Create_File_Directory

' create file if not exist
    Private Sub ButtonCreateFile_Click(sender As Object, e As EventArgs) Handles ButtonCreateFile.Click

        Dim filePath As String
        filePath = TextBoxFilePath.Text

        If File.Exists(filePath) Then

            MessageBox.Show("File Already Exists")

        Else
            File.Create(filePath)

        End If


    End Sub

' create folder if not exist
    Private Sub ButtonCreateFolder_Click(sender As Object, e As EventArgs) Handles ButtonCreateFolder.Click

        Dim folderPath As String
        folderPath = TextBoxFolder.Text

        If Directory.Exists(folderPath) Then

            MessageBox.Show("Folder Already Exists")

        Else

            Directory.CreateDirectory(folderPath)

        End If

    End Sub
End Class



VB.Net - File / Folder Exists

VB.Net - How To Check If File / Directory Exists Using Visual Basic.Net

VB.Net Folder Exists


In This VB.Net Tutorial  We Will See How To Verify If File Or A Folder Exists From A Path String Using Visual Basic.Net Programming Language.


Project Source Code:

Imports System.IO

Public Class File_Folder_Exist

' File Exists
    Private Sub ButtonFile_Click(sender As Object, e As EventArgs) Handles ButtonFile.Click

        Dim filePath As String
        filePath = TextBox_File_Path.Text

        If File.Exists(filePath) Then

            MessageBox.Show("File Exist")

        Else

            MessageBox.Show("File Not Exist")

        End If

    End Sub

' Folder Exists
    Private Sub ButtonFolder_Click(sender As Object, e As EventArgs) Handles ButtonFolder.Click

        Dim folderPath As String
        folderPath = TextBoxFolderPath.Text

        If Directory.Exists(folderPath) Then

            MessageBox.Show("Folder Exist")

        Else

            MessageBox.Show("Folder Not Exist")

        End If

    End Sub
End Class