Results 1 to 6 of 6
  1. #1
    Radu is offline Member
    Join Date
    Dec 2009
    Posts
    29
    Rep Power
    0

    Unhappy Translate Vb.net code into Java code

    Hello!
    Can someone please help me translate some VB.net program lines into Java? I made some jLists but I don't know how to show files like I did in VB.net.

  2. #2
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    Can you show us what you've done so far?

    I don't think anyone wants to do this for you here in the forum. You must give a try and show your effort.

  3. #3
    Radu is offline Member
    Join Date
    Dec 2009
    Posts
    29
    Rep Power
    0

    Unhappy

    OK

    This is VB.net code

    Java Code:
    Public Class xFer
    
        Dim deTrs As String = "D:\Radu\Lucru\Programare\Test\Trs\"
        Dim Clar As String = "D:\Radu\Lucru\Programare\Test\Cl\"
        Dim Cry As String = "D:\Radu\Lucru\Programare\Test\Cr\"
        Dim ClarSP As String = "D:\Radu\Lucru\Programare\Test\ClSP\"
        Dim CrySP As String = "D:\Radu\Lucru\Programare\Test\CrSP\"
        Dim Iesiri As String = "D:\Radu\Lucru\Programare\Test\Iesiri\"
    
    
        Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
    
            ListBox2.Items.Clear()
            ListBox3.Items.Clear()
            Select Case ListBox1.SelectedItem.ToString
                Case "A"
                    FolderContents1("D:\Radu\Lucru\Programare\Test\Trs\A\")
                    FolderContents2("D:\Radu\Lucru\Programare\Test\Rec\A\")
                Case "B"
                    FolderContents1("D:\Radu\Lucru\Programare\Test\Trs\B\")
                    FolderContents2("D:\Radu\Lucru\Programare\Test\Rec\B\")
                Case "C"
                    FolderContents1("D:\Radu\Lucru\Programare\Test\Trs\C\")
                    FolderContents2("D:\Radu\Lucru\Programare\Test\Rec\C\")
                Case "D"
                    FolderContents1("D:\Radu\Lucru\Programare\Test\Trs\D\")
                    FolderContents2("D:\Radu\Lucru\Programare\Test\Rec\D\")
                Case "K"
                    FolderContents1("D:\Radu\Lucru\Programare\Test\Trs\K\")
                    FolderContents2("D:\Radu\Lucru\Programare\Test\Rec\K\")
            End Select
    
        End Sub
        Private Sub FolderContents1(ByVal path As String)
    
            Dim di As New IO.DirectoryInfo(path)
            Dim aryFi As IO.FileInfo() = di.GetFiles("*.*")
            Dim fi As IO.FileInfo
            For Each fi In aryFi
    
                ListBox2.Items.Add(fi.Name)
                ListBox2.Refresh()
            Next
    
        End Sub
        Private Sub FolderContents2(ByVal path As String)
    
            Dim di As New IO.DirectoryInfo(path)
            Dim aryFi As IO.FileInfo() = di.GetFiles("*.*")
            Dim fi As IO.FileInfo
            For Each fi In aryFi
    
                ListBox3.Items.Add(fi.Name)
                ListBox3.Refresh()
            Next
    
        End Sub
    
        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    
            DateLabel.Text = Now.ToString("dd MMMM yyyy")
            TimeLabel.Text = TimeString
            ProgressBar.Minimum = 0
            ProgressBar.Maximum = 100
    
        End Sub
    
        Private Sub Timer1_Tick_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
    
            DateLabel.Text = Now.ToString("dd MMMM yyyy")
            TimeLabel.Text = TimeString
    
        End Sub
    
        Private Sub IesireRxFer_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles IesireRxFer.Click
    
            Me.Close()
    
        End Sub
        Private Sub Upload1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Upload1.Click
    
            For Each item In ListBox2.SelectedItems
                Dim sourceFile As String = deTrs & ListBox1.SelectedItem & "\" & item.ToString
                Dim destFile As String
                Dim fileInfo As IO.FileInfo
                fileInfo = New IO.FileInfo(sourceFile)
                destFile = Clar & fileInfo.Name
                IO.File.Move(sourceFile, destFile)
            Next
    
            ListBox1_SelectedIndexChanged(ListBox1, New EventArgs())
    
            Try
                Dim batProcess As New Process
                batProcess.StartInfo.FileName = "D:\Radu\Lucru\Programare\Test\Tipar.bat"
                batProcess.StartInfo.WindowStyle = ProcessWindowStyle.Normal
                batProcess.Start()
                batProcess.WaitForExit()
                batProcess.Close()
            Catch ex As Exception
                MessageBox.Show(ex.Message, "Error")
            End Try
    
            For Each file In IO.Directory.GetFiles(Cry)
                IO.File.Move(file, Iesiri & IO.Path.GetFileName(file))
            Next
        End Sub
    
        Private Sub Upload2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Upload2.Click
    
            For Each item In ListBox2.SelectedItems
                Dim sourceFile As String = deTrs & ListBox1.SelectedItem & "\" & item.ToString
                Dim destFile As String
                Dim fileInfo As IO.FileInfo
                fileInfo = New IO.FileInfo(sourceFile)
                destFile = ClarSP & fileInfo.Name
                IO.File.Move(sourceFile, destFile)
            Next
    
            ListBox1_SelectedIndexChanged(ListBox1, New EventArgs())
    
            Try
                Dim batProcess As New Process
                batProcess.StartInfo.FileName = "D:\Radu\Lucru\Programare\Test\TiparSP.bat"
                batProcess.StartInfo.WindowStyle = ProcessWindowStyle.Normal
                batProcess.Start()
                batProcess.WaitForExit()
                batProcess.Close()
            Catch ex As Exception
                MessageBox.Show(ex.Message, "Error")
            End Try
    
            For Each file In IO.Directory.GetFiles(CrySP)
                IO.File.Move(file, Iesiri & IO.Path.GetFileName(file))
            Next
        End Sub
    End Class

    (I'm sorry but I can't attach the VB.net file because is bigger than the limit of attachment), and the attachment is the Java version.
    Attached Files Attached Files

  4. #4
    Radu is offline Member
    Join Date
    Dec 2009
    Posts
    29
    Rep Power
    0

    Default

    Can someone help please?

    Java code:
    Java Code:
    package rxfer;
    
    import javax.swing.*;
    
    public class xFer extends System.Windows.Forms.Form
    {
    
    	
    	@Override
    	protected void dispose(boolean disposing)
    	{
    		try
    		{
    			if (disposing && components != null)
    			{
    				components.dispose();
    			}
    		}
    		finally
    		{
    			super.dispose(disposing);
    		}
    	}
    
    	private System.ComponentModel.IContainer components;
    
    	private void InitializeComponent()
    	{
    		this.components = new System.ComponentModel.Container();
    		System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(xFer.class);
    		this.GroupBox1 = new System.Windows.Forms.GroupBox();
    		this.ListBox1 = new System.Windows.Forms.ListBox();
    		this.GroupBox2 = new System.Windows.Forms.GroupBox();
    		this.ListBox2 = new System.Windows.Forms.ListBox();
    		this.GroupBox3 = new System.Windows.Forms.GroupBox();
    		this.ListBox3 = new System.Windows.Forms.ListBox();
    		this.StatusStrip = new System.Windows.Forms.StatusStrip();
    		this.ProgressBar = new System.Windows.Forms.ToolStripProgressBar();
    		this.DateLabel = new System.Windows.Forms.ToolStripStatusLabel();
    		this.TimeLabel = new System.Windows.Forms.ToolStripStatusLabel();
    		this.Meniu = new System.Windows.Forms.MenuStrip();
    		this.Upload = new System.Windows.Forms.ToolStripMenuItem();
    		this.Upload1 = new System.Windows.Forms.ToolStripMenuItem();
    		this.UploadSeparator = new System.Windows.Forms.ToolStripSeparator();
    		this.Upload2 = new System.Windows.Forms.ToolStripMenuItem();
    		this.Download = new System.Windows.Forms.ToolStripMenuItem();
    		this.Download1 = new System.Windows.Forms.ToolStripMenuItem();
    		this.DownloadSeparator = new System.Windows.Forms.ToolStripSeparator();
    		this.Download2 = new System.Windows.Forms.ToolStripMenuItem();
    		this.Bridge = new System.Windows.Forms.ToolStripMenuItem();
    		this.TransferBridge = new System.Windows.Forms.ToolStripMenuItem();
    		this.Iesire = new System.Windows.Forms.ToolStripMenuItem();
    		this.IesireRxFer = new System.Windows.Forms.ToolStripMenuItem();
    		this.Timer1 = new System.Windows.Forms.Timer(this.components);
    		this.GroupBox1.SuspendLayout();
    		this.GroupBox2.SuspendLayout();
    		this.GroupBox3.SuspendLayout();
    		this.StatusStrip.SuspendLayout();
    		this.Meniu.SuspendLayout();
    		this.SuspendLayout();
    		//
    		//GroupBox1
    		//
    		this.GroupBox1.Controls.Add(this.ListBox1);
    		this.GroupBox1.Font = new System.Drawing.Font("Arial", 9.0F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, (byte)238);
    		this.GroupBox1.Location = new System.Drawing.Point(11, 27);
    		this.GroupBox1.Name = "GroupBox1";
    		this.GroupBox1.Size = new System.Drawing.Size(200, 510);
    		this.GroupBox1.TabIndex = 0;
    		this.GroupBox1.TabStop = false;
    		this.GroupBox1.Text = "Grupuri";
    		//
    		//ListBox1
    		//
    		this.ListBox1.Font = new System.Drawing.Font("Arial", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, (byte)238);
    		this.ListBox1.FormattingEnabled = true;
    		this.ListBox1.ItemHeight = 16;
    		this.ListBox1.Items.AddRange(new Object[] {"A", "B", "C", "D", "K"});
    		this.ListBox1.Location = new System.Drawing.Point(7, 20);
    		this.ListBox1.Name = "ListBox1";
    		this.ListBox1.Size = new System.Drawing.Size(187, 484);
    		this.ListBox1.TabIndex = 0;
    		//
    		//GroupBox2
    		//
    		this.GroupBox2.Controls.Add(this.ListBox2);
    		this.GroupBox2.Font = new System.Drawing.Font("Arial", 9.0F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, (byte)238);
    		this.GroupBox2.Location = new System.Drawing.Point(217, 27);
    		this.GroupBox2.Name = "GroupBox2";
    		this.GroupBox2.Size = new System.Drawing.Size(200, 510);
    		this.GroupBox2.TabIndex = 1;
    		this.GroupBox2.TabStop = false;
    		this.GroupBox2.Text = "Fisiere de transmis";
    		//
    		//ListBox2
    		//
    		this.ListBox2.Font = new System.Drawing.Font("Arial", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, (byte)238);
    		this.ListBox2.FormattingEnabled = true;
    		this.ListBox2.ItemHeight = 16;
    		this.ListBox2.Location = new System.Drawing.Point(7, 20);
    		this.ListBox2.Name = "ListBox2";
    		this.ListBox2.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended;
    		this.ListBox2.Size = new System.Drawing.Size(187, 484);
    		this.ListBox2.TabIndex = 0;
    		//
    		//GroupBox3
    		//
    		this.GroupBox3.Controls.Add(this.ListBox3);
    		this.GroupBox3.Font = new System.Drawing.Font("Arial", 9.0F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, (byte)238);
    		this.GroupBox3.Location = new System.Drawing.Point(423, 27);
    		this.GroupBox3.Name = "GroupBox3";
    		this.GroupBox3.Size = new System.Drawing.Size(200, 510);
    		this.GroupBox3.TabIndex = 2;
    		this.GroupBox3.TabStop = false;
    		this.GroupBox3.Text = "Fisiere receptionate";
    		//
    		//ListBox3
    		//
    		this.ListBox3.Font = new System.Drawing.Font("Arial", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, (byte)238);
    		this.ListBox3.FormattingEnabled = true;
    		this.ListBox3.ItemHeight = 16;
    		this.ListBox3.Location = new System.Drawing.Point(7, 20);
    		this.ListBox3.Name = "ListBox3";
    		this.ListBox3.SelectionMode = System.Windows.Forms.SelectionMode.None;
    		this.ListBox3.Size = new System.Drawing.Size(187, 484);
    		this.ListBox3.TabIndex = 0;
    		//
    		//StatusStrip
    		//
    		this.StatusStrip.BackColor = System.Drawing.Color.SeaGreen;
    		this.StatusStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {this.ProgressBar, this.DateLabel, this.TimeLabel});
    		this.StatusStrip.Location = new System.Drawing.Point(0, 545);
    		this.StatusStrip.Name = "StatusStrip";
    		this.StatusStrip.Size = new System.Drawing.Size(635, 22);
    		this.StatusStrip.TabIndex = 3;
    		//
    		//ProgressBar
    		//
    		this.ProgressBar.Name = "ProgressBar";
    		this.ProgressBar.Size = new System.Drawing.Size(100, 16);
    		//
    		//DateLabel
    		//
    		this.DateLabel.Font = new System.Drawing.Font("Arial", 9.0F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, (byte)238);
    		this.DateLabel.Name = "DateLabel";
    		this.DateLabel.Size = new System.Drawing.Size(483, 17);
    		this.DateLabel.Spring = true;
    		this.DateLabel.Text = "Date";
    		this.DateLabel.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
    		//
    		//TimeLabel
    		//
    		this.TimeLabel.Font = new System.Drawing.Font("Arial", 9.0F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, (byte)238);
    		this.TimeLabel.Name = "TimeLabel";
    		this.TimeLabel.Size = new System.Drawing.Size(35, 17);
    		this.TimeLabel.Text = "Time";
    		//
    		//Meniu
    		//
    		this.Meniu.BackColor = System.Drawing.Color.SeaGreen;
    		this.Meniu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {this.Upload, this.Download, this.Bridge, this.Iesire});
    		this.Meniu.Location = new System.Drawing.Point(0, 0);
    		this.Meniu.Name = "Meniu";
    		this.Meniu.Size = new System.Drawing.Size(635, 24);
    		this.Meniu.TabIndex = 6;
    		//
    		//Upload
    		//
    		this.Upload.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {this.Upload1, this.UploadSeparator, this.Upload2});
    		this.Upload.Font = new System.Drawing.Font("Arial", 9.0F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, (byte)238);
    		this.Upload.Name = "Upload";
    		this.Upload.Size = new System.Drawing.Size(59, 20);
    		this.Upload.Text = "Upload";
    		//
    		//Upload1
    		//
    		this.Upload1.Name = "Upload1";
    		this.Upload1.Size = new System.Drawing.Size(152, 22);
    		this.Upload1.Text = "Upload 1";
    		//
    		//UploadSeparator
    		//
    		this.UploadSeparator.Name = "UploadSeparator";
    		this.UploadSeparator.Size = new System.Drawing.Size(149, 6);
    		//
    		//Upload2
    		//
    		this.Upload2.Name = "Upload2";
    		this.Upload2.Size = new System.Drawing.Size(152, 22);
    		this.Upload2.Text = "Upload 2";
    		//
    		//Download
    		//
    		this.Download.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {this.Download1, this.DownloadSeparator, this.Download2});
    		this.Download.Font = new System.Drawing.Font("Arial", 9.0F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, (byte)238);
    		this.Download.Name = "Download";
    		this.Download.Size = new System.Drawing.Size(75, 20);
    		this.Download.Text = "Download";
    		//
    		//Download1
    		//
    		this.Download1.Name = "Download1";
    		this.Download1.Size = new System.Drawing.Size(140, 22);
    		this.Download1.Text = "Download 1";
    		//
    		//DownloadSeparator
    		//
    		this.DownloadSeparator.Name = "DownloadSeparator";
    		this.DownloadSeparator.Size = new System.Drawing.Size(137, 6);
    		//
    		//Download2
    		//
    		this.Download2.Name = "Download2";
    		this.Download2.Size = new System.Drawing.Size(140, 22);
    		this.Download2.Text = "Download 2";
    		//
    		//Bridge
    		//
    		this.Bridge.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {this.TransferBridge});
    		this.Bridge.Name = "Bridge";
    		this.Bridge.Size = new System.Drawing.Size(53, 20);
    		this.Bridge.Text = "Bridge";
    		//
    		//TransferBridge
    		//
    		this.TransferBridge.Name = "TransferBridge";
    		this.TransferBridge.Size = new System.Drawing.Size(154, 22);
    		this.TransferBridge.Text = "Transfer Bridge";
    		//
    		//Iesire
    		//
    		this.Iesire.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {this.IesireRxFer});
    		this.Iesire.Font = new System.Drawing.Font("Arial", 9.0F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, (byte)238);
    		this.Iesire.Name = "Iesire";
    		this.Iesire.Size = new System.Drawing.Size(50, 20);
    		this.Iesire.Text = "Iesire";
    		//
    		//IesireRxFer
    		//
    		this.IesireRxFer.Name = "IesireRxFer";
    		this.IesireRxFer.Size = new System.Drawing.Size(140, 22);
    		this.IesireRxFer.Text = "Iesire RxFer";
    		//
    		//Timer1
    		//
    		this.Timer1.Enabled = true;
    		this.Timer1.Interval = 1;
    		//
    		//xFer
    		//
    		this.AutoScaleDimensions = new System.Drawing.SizeF(6.0F, 13.0F);
    		this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
    		this.BackColor = System.Drawing.Color.SeaGreen;
    		this.ClientSize = new System.Drawing.Size(635, 567);
    		this.Controls.Add(this.StatusStrip);
    		this.Controls.Add(this.Meniu);
    		this.Controls.Add(this.GroupBox3);
    		this.Controls.Add(this.GroupBox2);
    		this.Controls.Add(this.GroupBox1);
    		this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D;
    		this.Icon = (System.Drawing.Icon)(resources.GetObject("$this.Icon"));
    		this.Name = "xFer";
    		this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
    		this.Text = "...:: RxFer v2 ::...";
    		this.GroupBox1.ResumeLayout(false);
    		this.GroupBox2.ResumeLayout(false);
    		this.GroupBox3.ResumeLayout(false);
    		this.StatusStrip.ResumeLayout(false);
    		this.StatusStrip.PerformLayout();
    		this.Meniu.ResumeLayout(false);
    		this.Meniu.PerformLayout();
    		this.ResumeLayout(false);
    		this.PerformLayout();
    
    	}
    	public System.Windows.Forms.GroupBox GroupBox1;
    	public System.Windows.Forms.ListBox ListBox1;
    	public System.Windows.Forms.GroupBox GroupBox2;
    	public System.Windows.Forms.ListBox ListBox2;
    	public System.Windows.Forms.GroupBox GroupBox3;
    	public System.Windows.Forms.ListBox ListBox3;
    	public System.Windows.Forms.StatusStrip StatusStrip;
    	public System.Windows.Forms.MenuStrip Meniu;
    	public System.Windows.Forms.ToolStripProgressBar ProgressBar;
    	public System.Windows.Forms.ToolStripStatusLabel DateLabel;
    	public System.Windows.Forms.ToolStripStatusLabel TimeLabel;
    	public System.Windows.Forms.Timer Timer1;
    	public System.Windows.Forms.ToolStripMenuItem Upload;
    	public System.Windows.Forms.ToolStripMenuItem Download;
    	public System.Windows.Forms.ToolStripMenuItem Iesire;
    	public System.Windows.Forms.ToolStripMenuItem Upload1;
    	public System.Windows.Forms.ToolStripMenuItem Upload2;
    	public System.Windows.Forms.ToolStripMenuItem Download1;
    	public System.Windows.Forms.ToolStripMenuItem Download2;
    	public System.Windows.Forms.ToolStripMenuItem IesireRxFer;
    	public System.Windows.Forms.ToolStripMenuItem Bridge;
    	public System.Windows.Forms.ToolStripMenuItem TransferBridge;
    	public System.Windows.Forms.ToolStripSeparator UploadSeparator;
    	public System.Windows.Forms.ToolStripSeparator DownloadSeparator;
    
    
    
    
    	private String deTrs = "D:\\Radu\\Lucru\\Programare\\Test\\Trs\\";
    	private String Clar = "D:\\Radu\\Lucru\\Programare\\Test\\Cl\\";
    	private String Cry = "D:\\Radu\\Lucru\\Programare\\Test\\Cr\\";
    	private String ClarSP = "D:\\Radu\\Lucru\\Programare\\Test\\ClSP\\";
    	private String CrySP = "D:\\Radu\\Lucru\\Programare\\Test\\CrSP\\";
    	private String Iesiri = "D:\\Radu\\Lucru\\Programare\\Test\\Iesiri\\";
    
    	private void ListBox1_SelectedIndexChanged(Object sender, System.EventArgs e)
    	{
    
    		ListBox2.Items.Clear();
    		ListBox3.Items.Clear();
    
    		if (ListBox1.SelectedItem.toString().equals("A"))
    		{
    				FolderContents1("D:\\Radu\\Lucru\\Programare\\Test\\Trs\\A\\");
    				FolderContents2("D:\\Radu\\Lucru\\Programare\\Test\\Rec\\A\\");
    		}
    
                    else if (ListBox1.SelectedItem.toString().equals("B"))
    		{
    				FolderContents1("D:\\Radu\\Lucru\\Programare\\Test\\Trs\\B\\");
    				FolderContents2("D:\\Radu\\Lucru\\Programare\\Test\\Rec\\B\\");
    		}
    
                    else if (ListBox1.SelectedItem.toString().equals("C"))
    		{
    				FolderContents1("D:\\Radu\\Lucru\\Programare\\Test\\Trs\\C\\");
    				FolderContents2("D:\\Radu\\Lucru\\Programare\\Test\\Rec\\C\\");
    		}
    
                    else if (ListBox1.SelectedItem.toString().equals("D"))
    		{
    				FolderContents1("D:\\Radu\\Lucru\\Programare\\Test\\Trs\\D\\");
    				FolderContents2("D:\\Radu\\Lucru\\Programare\\Test\\Rec\\D\\");
    		}
    
                    else if (ListBox1.SelectedItem.toString().equals("K"))
    		{
    				FolderContents1("D:\\Radu\\Lucru\\Programare\\Test\\Trs\\K\\");
    				FolderContents2("D:\\Radu\\Lucru\\Programare\\Test\\Rec\\K\\");
    		}
    
    	}
    	private void FolderContents1(String path)
    	{
    
    		IO.DirectoryInfo di = new IO.DirectoryInfo(path);
    		IO.FileInfo[] aryFi = di.GetFiles("*.*");
    
    		for (IO.FileInfo fi : aryFi)
    		{
    
    			ListBox2.Items.Add(fi.Name);
    			ListBox2.Refresh();
    		}
    
    	}
    	private void FolderContents2(String path)
    	{
    
    		IO.DirectoryInfo di = new IO.DirectoryInfo(path);
    		IO.FileInfo[] aryFi = di.GetFiles("*.*");
                    
    		for (IO.FileInfo fi : aryFi)
    		{
    
    			ListBox3.Items.Add(fi.Name);
    			ListBox3.Refresh();
    		}
    
    	}
    
    	private void Form1_Load(Object sender, System.EventArgs e)
    	{
    
    		DateLabel.Text = String.format("%d", DateTime.Now);
    		TimeLabel.Text = Microsoft.VisualBasic.DateAndTime.TimeString;
    		ProgressBar.Minimum = 0;
    		ProgressBar.Maximum = 100;
    
    	}
    
    	private void Timer1_Tick_1(Object sender, System.EventArgs e)
    	{
    
    		DateLabel.Text = String.format("%d", DateTime.Now);
    		TimeLabel.Text = Microsoft.VisualBasic.DateAndTime.TimeString;
    
    	}
    
    	private void IesireRxFer_Click(Object sender, System.EventArgs e)
    	{
    
    		this.Close();
    
    	}
    
    	private void Upload1_Click(Object sender, System.EventArgs e)
    	{
    
    		for (Object item : ListBox2.SelectedItems)
    		{
    			String sourceFile = deTrs + ListBox1.SelectedItem + "\\" + item.toString();
    			String destFile = null;
    			IO.FileInfo fileInfo = null;
    			fileInfo = new IO.FileInfo(sourceFile);
    			destFile = Clar + fileInfo.Name;
    			IO.File.Move(sourceFile, destFile);
    		}
    
    		ListBox1_SelectedIndexChanged(ListBox1, new EventArgs());
    
    		try
    		{
    			Process batProcess = new Process();
    			batProcess.StartInfo.FileName = "D:\\Radu\\Lucru\\Programare\\Test\\Tipar.bat";
    			batProcess.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
    			batProcess.Start();
    			batProcess.WaitForExit();
    			batProcess.Close();
    		}
    		catch (RuntimeException ex)
    		{
    			JOptionPane.showConfirmDialog(null, ex.getMessage(), "Error", JOptionPane.DEFAULT_OPTION);
    		}
    
    		for (Object file : IO.Directory.GetFiles(Cry))
    		{
    			IO.File.Move(file, Iesiri + IO.Path.GetFileName(file));
    		}
    	}
    
    	private void Upload2_Click(Object sender, System.EventArgs e)
    	{
    
    		for (Object item : ListBox2.SelectedItems)
    		{
    			String sourceFile = deTrs + ListBox1.SelectedItem + "\\" + item.toString();
    			String destFile = null;
    			IO.FileInfo fileInfo = null;
    			fileInfo = new IO.FileInfo(sourceFile);
    			destFile = ClarSP + fileInfo.Name;
    			IO.File.Move(sourceFile, destFile);
    		}
    
    		ListBox1_SelectedIndexChanged(ListBox1, new EventArgs());
    
    		try
    		{
    			Process batProcess = new Process();
    			batProcess.StartInfo.FileName = "D:\\Radu\\Lucru\\Programare\\Test\\TiparSP.bat";
    			batProcess.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
    			batProcess.Start();
    			batProcess.WaitForExit();
    			batProcess.Close();
    		}
    		catch (RuntimeException ex)
    		{
    			JOptionPane.showConfirmDialog(null, ex.getMessage(), "Error", JOptionPane.DEFAULT_OPTION);
    		}
    
    		for (Object file : IO.Directory.GetFiles(CrySP))
    		{
    			IO.File.Move(file, Iesiri + IO.Path.GetFileName(file));
    		}
    	}
    }
    Last edited by Radu; 04-11-2011 at 08:03 AM.

  5. #5
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

  6. #6
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

Similar Threads

  1. Replies: 0
    Last Post: 02-21-2011, 12:50 PM
  2. Replies: 1
    Last Post: 03-04-2010, 12:19 PM
  3. Convert java code to midlet code
    By coldvoice05 in forum New To Java
    Replies: 1
    Last Post: 08-12-2009, 12:14 PM
  4. Convert java code to midlet code
    By coldvoice05 in forum Advanced Java
    Replies: 1
    Last Post: 08-09-2009, 02:21 PM
  5. Replies: 1
    Last Post: 04-26-2007, 04:52 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •