Jump to content

Display a variable in a GUI window


Recommended Posts

For starters, I'm not new to coding, just new to C# and poking around in KSP. All I have right now is 4 broken lines of code that display a window without drawing anything. All I'm trying to put in this window is currently the hard coded value of a variable. Does anyone have a few lines code that demonstrates this?

Link to comment
Share on other sites

Thanks, but I'm still having problems and I can't seem to find an answer. How do I display a variable (type double) in a GUI window? I can successfully draw the window, and I can display a string, but I can't do calculated numbers. So far all I've figured out is this works nothing like VB.net.

Link to comment
Share on other sites

The script compiles and runs, but it doesn't work in KSP. I'm getting this error in the debug console:

[Exception]: FileNotFoundException: Could not load file or assembly 'System.Runtime, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies.

Link to comment
Share on other sites

The script compiles and runs, but it doesn't work in KSP. I'm getting this error in the debug console:

[Exception]: FileNotFoundException: Could not load file or assembly 'System.Runtime, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies.

That didn't really answer any question above, and without the full output_log.txt it's hard to tell much from that :/

Link to comment
Share on other sites

I'm not sure, to be honest. I am using the same Visual Studio that you are though I am on Win7 rather than 8. It may be that the VS2013 installer didn't install the necessary files for .NET 3.5 because it wasn't enabled when you installed it so you could try reinstalling VS (or modifying the install if it lets you). If there is a "custom" option in the installer then check to make sure the required bits are selected...

Link to comment
Share on other sites

You should go take a look in your "uninstall programs" tool to see if you do have .NET 3.5 installed on your computer. Othger than that, I have VSExpress 2013 on windows 8 and I'm doing perfectly fine.

I think only SDKs show up in the Programs and Features control panel applet (the "uninstall programs" tool I think you are referring to):

xgTpaot.png

S/he's also mentioned enabling it in the control panel, which presumably means the little dialog that appears if you click "Turn Windows features on or off".

Hmm. Maybe they should check if .NET 3.5 is actually installed by checking if the folder actually exists: C:\Windows\Microsoft.NET\Framework\v3.5

Link to comment
Share on other sites

I uninstalled and reinstalled .net 3.5 just to be sure, but that didn't fix anything. I also went to the folder Echo suggested, and it was there. The last thing I can think of is that I'm using the wrong kind of project, something that's not compatible with .net 3.5. The KSP wiki said to use a C# class library, and I chose the "Class Library (Portable for Universal Apps)" because it was the first option I saw.

Link to comment
Share on other sites

Have you tried changing (or at least checking) the install options of Visual Studio 2013? Alternatively, the dropdown to select which framework your project is targeting should have an "Install other frameworks..." option at the bottom of the list which will probably do something useful...

Link to comment
Share on other sites

I uninstalled and reinstalled .net 3.5 just to be sure, but that didn't fix anything. I also went to the folder Echo suggested, and it was there. The last thing I can think of is that I'm using the wrong kind of project, something that's not compatible with .net 3.5. The KSP wiki said to use a C# class library, and I chose the "Class Library (Portable for Universal Apps)" because it was the first option I saw.

Well, there's your problem. Portable class libraries are there if you want to create a class library that supports desktop, metro-style desktop apps, Windows Phone apps, Silverlight. etc., and as a consequence, require a minimum level of .Net 4.0 (I think that's minimum metro apps support). Just recreate the project, except pick the non-portable Class Library project type.

Edited by Echo 8 ÉRÀ
Link to comment
Share on other sites

It looks like I was bested by windows 8 once again. I was unknowingly using the metro version of visual studio 2013, which limits you to a portable class library. I switched to the desktop version, and everything magically worked.

Thanks for the help.

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...