เขียน code vb.net ให้เปิดไฟล์ pdf อย่างไรครับ คืออยากทราบวิธีการเขียนโค๊ดการสั่งเปิดไฟล์ pdf อ่ะครับ
Form1.Designer.cs
namespace OpenDialog
{
partial class Form1
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.button1 = new System.Windows.Forms.Button();
this.textBox1 = new System.Windows.Forms.TextBox();
this.button2 = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// button1
//
this.button1.Location = new System.Drawing.Point(205, 12);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 0;
this.button1.Text = "Brows...";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(12, 14);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(187, 20);
this.textBox1.TabIndex = 1;
//
// button2
//
this.button2.Location = new System.Drawing.Point(109, 58);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(75, 23);
this.button2.TabIndex = 2;
this.button2.Text = "Open";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(292, 102);
this.Controls.Add(this.button2);
this.Controls.Add(this.textBox1);
this.Controls.Add(this.button1);
this.Name = "Form1";
this.Text = "Form1";
this.Load += new System.EventHandler(this.Form1_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button button1;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.Button button2;
}
}
Form1.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace OpenDialog
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
button2.Enabled = false;
}
private void button1_Click(object sender, EventArgs e)
{
OpenFileDialog brows = new OpenFileDialog();
brows.FileName = string.Empty;
if (brows.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
textBox1.Text = brows.FileName;
button2.Enabled = true;
}
brows.Dispose();
}
private void button2_Click(object sender, EventArgs e)
{
System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.EnableRaisingEvents = false;
proc.StartInfo.FileName = textBox1.Text;
proc.Start();
}
}
}
ปล. ไม่ต้องท้วงเพราะตั้งใจเขียน c#
Date :
2010-06-26 16:30:04
By :
tungman
ขอบคุณครับ C# หรือ VB.net ก็แปลไปมาได้ง่ายอยู่แล้ว
Date :
2010-06-27 09:58:55
By :
chettana
Load balance : Server 03