This works (VB):
This does not (code behind, c#):
The problem is the
label1.Text = "Homeseer Versions: " + hs.version;
call, compiler barfs and says there is no definition for version in type object. I don't understand how that command works in VB either... Please enlighten!
Regards,
Tim
Code:
script runat="server"> ' Insert page code here ' dim hs as object Sub Page_Load(Sender As Object, E As EventArgs) ' for use with the HS web server hs = Context.Items("Content") If hs Is Nothing Then ' maybe running under IIS hs = Global.ASP.global_asax.hs If hs Is Nothing Then Response.Write("Could not get access to HomeSeer object, is HomeSeer running?") End If End If Label1.Text = "HomeSeer Ver: " & hs.version end sub Sub ButSpeak_Click(sender As Object, e As EventArgs) hs.speak(txtspeak.text) End Sub
Code:
using System; using System.Collections; using System.Configuration; using System.Data; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Runtime.InteropServices; public partial class c : System.Web.UI.Page { private object hs; protected void Page_Load(object sender, EventArgs e) { hs = Context.Items["Content"]; if (hs == null) { hs = global::ASP.global_asax.hs; if (hs == null) { Response.Write("Could not get access to HomeSeer object, is HomeSeer running?"); } } else { label1.Text = "Homeseer Versions: " + hs.version; } } public void ButSpeak_Click(object sender, EventArgs e) { hs.speak(txtspeak.text); } }
label1.Text = "Homeseer Versions: " + hs.version;
call, compiler barfs and says there is no definition for version in type object. I don't understand how that command works in VB either... Please enlighten!
Regards,
Tim
Comment