5 Replies - 2471 Views - Last Post: 20 December 2010 - 08:20 AM Rate Topic: -----

#1 btee  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 48
  • Joined: 09-January 10

Converting VB.net to C#

Posted 19 December 2010 - 11:56 AM

I am trying to get a holiday tracker code that i converted from VB.net to C# to work, but I cannot get it to work.
looking for any help or suggestions to point me in the right direction

This post has been edited by btee: 19 December 2010 - 11:57 AM

Is This A Good Question/Topic? 0
  • +

Replies To: Converting VB.net to C#

#2 elbielefeld  Icon User is offline

  • D.I.C Head

Reputation: 70
  • View blog
  • Posts: 216
  • Joined: 18-May 10

Re: Converting VB.net to C#

Posted 19 December 2010 - 12:14 PM

What's the problem?
Was This Post Helpful? 0
  • +
  • -

#3 btee  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 48
  • Joined: 09-January 10

Re: Converting VB.net to C#

Posted 19 December 2010 - 12:21 PM

i created the basic form, but when I try to cut and paste the converted C# code I get no change.
here is the code. i think the convertor did not convert it
using Microsoft.VisualBasic;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics;
[Microsoft.VisualBasic.CompilerServices.DesignerGenerated()]
partial class Form1 : System.Windows.Forms.Form
{

	//Form overrides dispose to clean up the component list.
	[System.Diagnostics.DebuggerNonUserCode()]
	protected override void Dispose(bool disposing)
	{
		try {
			if (disposing && components != null) {
				components.Dispose();
			}
		} finally {
			base.Dispose(disposing);
		}
	}

	//Required by the Windows Form Designer

	private System.ComponentModel.IContainer components;
	//NOTE: The following procedure is required by the Windows Form Designer
	//It can be modified using the Windows Form Designer.  
	//Do not modify it using the code editor.
	[System.Diagnostics.DebuggerStepThrough()]
	private void InitializeComponent()
	{
		this.DateTimePicker1 = new System.Windows.Forms.DateTimePicker();
		this.Button1 = new System.Windows.Forms.Button();
		this.Label1 = new System.Windows.Forms.Label();
		this.MenuStrip1 = new System.Windows.Forms.MenuStrip();
		this.ViewListOfHolidaysToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
		this.ExitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
		this.Label2 = new System.Windows.Forms.Label();
		this.MenuStrip1.SuspendLayout();
		this.SuspendLayout();
		//
		//DateTimePicker1
		//
		this.DateTimePicker1.Location = new System.Drawing.Point(50, 66);
		this.DateTimePicker1.Name = "DateTimePicker1";
		this.DateTimePicker1.Size = new System.Drawing.Size(200, 20);
		this.DateTimePicker1.TabIndex = 0;
		//
		//Button1
		//
		this.Button1.Location = new System.Drawing.Point(77, 118);
		this.Button1.Name = "Button1";
		this.Button1.Size = new System.Drawing.Size(98, 23);
		this.Button1.TabIndex = 1;
		this.Button1.Text = "Mark as holiday";
		this.Button1.UseVisualStyleBackColor = true;
		//
		//Label1
		//
		this.Label1.AutoSize = true;
		this.Label1.Location = new System.Drawing.Point(47, 40);
		this.Label1.Name = "Label1";
		this.Label1.Size = new System.Drawing.Size(70, 13);
		this.Label1.TabIndex = 2;
		this.Label1.Text = "Select a date";
		//
		//MenuStrip1
		//
		this.MenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
			this.ViewListOfHolidaysToolStripMenuItem,
			this.ExitToolStripMenuItem
		});
		this.MenuStrip1.Location = new System.Drawing.Point(0, 0);
		this.MenuStrip1.Name = "MenuStrip1";
		this.MenuStrip1.Size = new System.Drawing.Size(292, 24);
		this.MenuStrip1.TabIndex = 3;
		this.MenuStrip1.Text = "MenuStrip1";
		//
		//ViewListOfHolidaysToolStripMenuItem
		//
		this.ViewListOfHolidaysToolStripMenuItem.Name = "ViewListOfHolidaysToolStripMenuItem";
		this.ViewListOfHolidaysToolStripMenuItem.Size = new System.Drawing.Size(115, 20);
		this.ViewListOfHolidaysToolStripMenuItem.Text = "View List of holidays";
		//
		//ExitToolStripMenuItem
		//
		this.ExitToolStripMenuItem.Name = "ExitToolStripMenuItem";
		this.ExitToolStripMenuItem.Size = new System.Drawing.Size(37, 20);
		this.ExitToolStripMenuItem.Text = "Exit";
		//
		//Label2
		//
		this.Label2.AutoSize = true;
		this.Label2.Location = new System.Drawing.Point(141, 182);
		this.Label2.Name = "Label2";
		this.Label2.Size = new System.Drawing.Size(0, 13);
		this.Label2.TabIndex = 4;
		this.Label2.Visible = false;
		//
		//Form1
		//
		this.AutoScaleDimensions = new System.Drawing.SizeF(6f, 13f);
		this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
		this.ClientSize = new System.Drawing.Size(292, 266);
		this.Controls.Add(this.Label2);
		this.Controls.Add(this.Label1);
		this.Controls.Add(this.Button1);
		this.Controls.Add(this.DateTimePicker1);
		this.Controls.Add(this.MenuStrip1);
		this.MainMenuStrip = this.MenuStrip1;
		this.Name = "Form1";
		this.Text = "Form1";
		this.MenuStrip1.ResumeLayout(false);
		this.MenuStrip1.PerformLayout();
		this.ResumeLayout(false);
		this.PerformLayout();

	}
	internal System.Windows.Forms.DateTimePicker DateTimePicker1;
	internal System.Windows.Forms.Button Button1;
	internal System.Windows.Forms.Label Label1;
	internal System.Windows.Forms.MenuStrip MenuStrip1;
	internal System.Windows.Forms.ToolStripMenuItem ViewListOfHolidaysToolStripMenuItem;
	internal System.Windows.Forms.ToolStripMenuItem ExitToolStripMenuItem;

	internal System.Windows.Forms.Label Label2;
	public Form1()
	{
		InitializeComponent();
	}
}


Was This Post Helpful? 0
  • +
  • -

#4 Sergio Tapia  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 1251
  • View blog
  • Posts: 4,168
  • Joined: 27-January 10

Re: Converting VB.net to C#

Posted 19 December 2010 - 12:58 PM

What do you mean, "I get no change"? Your question doesn't make sense. Clearly tell us what you want vs. what you're getting.
Was This Post Helpful? 0
  • +
  • -

#5 btee  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 48
  • Joined: 09-January 10

Re: Converting VB.net to C#

Posted 19 December 2010 - 02:16 PM

View PostSergio Tapia, on 19 December 2010 - 11:58 AM, said:

What do you mean, "I get no change"? Your question doesn't make sense. Clearly tell us what you want vs. what you're getting.


after i open visual studio where do paste the converted code?
Was This Post Helpful? 0
  • +
  • -

#6 Curtis Rutland  Icon User is online

  • (╯□)╯︵ (~ .o.)~
  • member icon


Reputation: 4316
  • View blog
  • Posts: 7,485
  • Joined: 08-June 10

Re: Converting VB.net to C#

Posted 20 December 2010 - 08:20 AM

I would strongly suggest against using a converter. For one, you have no idea what the output means, since you didn't write it yourself, which will make it hard to debug problems. And 2, I don't trust them to be perfect.

Here's a cheat sheet on converting between C# and VB.NET:
http://www.harding.e...comparison.html
Was This Post Helpful? 3
  • +
  • -

Page 1 of 1