Microsoft has made a great job with Visual Studio IDE for building Windows Applications and they even generously
offer Visual Studio Express Editions. So you may like to use Winform instead of Rebol’s VID or you just don’t want to re-develop everything and want to integrate a Rebol’s library with your .NET application, here’s how to do it simply based on Rebtweeter example. If you haven’t read the Rebtweeter’s Project announcement, in short, Rebtweeter is a new Opensource Project for building multi-heteregeneous-platform Clients with Rebol application as Local or Remote Server.
So here the Rebtweeter Winform we built (it’s only a Functional Prototype, not the final GUI yet):

Here’s the C# source code (you should be able to easily translate it into VB.NET - will try using this online converter myself) that you can download from here (Visual Studio Project Files):
using System;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
//Do not forget this for spawning Process:
using System.Diagnostics;
namespace command_line
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
}
private void label2_Click(object sender, EventArgs e)
{
}
private void Form1_Load(object sender, EventArgs e)
{
// Init Values of Action ComboBox
DataTable DataTable;
DataTable = new DataTable();
DataTable.Columns.Add("id", typeof(int));
DataTable.Columns.Add("Action");
DataTable.Rows.Add(1, "Tweet");
DataTable.Rows.Add(2, "Talk to");
DataTable.Rows.Add(3, "Link to");
this.cboAction.DisplayMember = "Action";
this.cboAction.ValueMember = "id";
this.cboAction.DataSource = DataTable;
}
private void cmdClose_Click(object sender, EventArgs e)
{
this.Close();
}
private void cboAction_SelectedIndexChanged(object sender, EventArgs e)
{
txtCommand.Text = cboAction.Text + " ";
}
private void cmdOK_Click(object sender, EventArgs e)
{
Process p = new Process();
p.StartInfo.Arguments = "-w c:\\rebol\\rebtweeter.r " + txtAccount.Text + "/" + txtPassword.Text + " " + txtCommand.Text ;
p.StartInfo.WorkingDirectory = @"C:\rebol";
p.StartInfo.FileName = @"C:\rebol\rebol.exe";
p.StartInfo.CreateNoWindow = true;
p.Start();
p.WaitForExit();
MessageBox.Show("The End");
}
}
}
I won’t teach you .NET on this site of course so I will just make a few recall. You should use System.Diagnostics Namespace to be able to use Process object and call an external excutable. If you don’t want to show any OS window you should use this instruction:
p.StartInfo.CreateNoWindow = true;
You also need to wait for Rebol program to finish so you use
p.WaitForExit();
To pass arguments to Rebol we just use p.StartInfo.Arguments. By arbitrary convention, we choose to concatenate the login and password with a “/” separator. Remark the -w at the beginning of the arguments, it’s to disable Rebol from showing its console’s window otherwise this would create an ugly flash effect.
Since we are lazy, we want to reuse our last Rebtweeter CGI program without breaking existing web-clients like Rebtweeter.com and others in the future. So we will extend it with this little code section:
if/else ((length? cgi-string) > 0) [
cgi: construct decode-cgi cgi-string
][
command-line: system/options/args
login-password: parse command-line/1 "/"
remove command-line
cgi: make object! [
account: login-password/1
password: login-password/2
command: reform command-line
]
]
Here’s the result of twitter ouput:

You can download the whole code from here in the directory you set in your C# program (here c:\rebol).
That’s all, you got the best of two Worlds: Winform + Rebol, isn’t life fun
















Forgot to upload Visual Studio File, now done.