|
how can i open an exe file in a C# window?
i see an example in other site which open all open exe files in diffrent tabs.
but i want open my exe file in a panel ... how can i do this?
|
|
|
|
|
MarziehA wrote: how can i open an exe file in a C# window?
Start the executable, grab it's mainwindow, and use the SetParent -API.
MarziehA wrote: how can i do this?
This article[^] might help
I are Troll
|
|
|
|
|
I am writing a mobile device program for my university coursework but I am coming up against a few problems or limitations, I am not sure which, the two problems which I am finding is that I do not have some functionality which I normally have when writing for normal windows forms. The two problems I have is when I try and assign an Enum to a combo box,
Private Enum X
//Set of enums
End Enum
ComboBox1.DataSource = Enum.GetValues(GetType(x))
I am finding that I am not able to uses the "GetValues" or "GetTypes" of the enum functionality, which means that I can’t populate the combo box correctly. This is also found when the ImageConverter function which exists for normal windows form but doesn't exists when writing for the mobile framework.
Any help would be greatly appreciated.
|
|
|
|
|
It is annoying but that is the limitations of the compact framework - Missing properties and methods so you have to be more creative!
How about using a list as the source or failing that a generic routine to populate a combo box.
Try posting in the Mobile forum. They may have more for you.
Regards
The FoZ
|
|
|
|
|
I've been able to do it by using AddRange
Array arr = System.Enum.GetValues(typeof(MyEnum));
object[] oArr = new object[arr.length];
arr.CopyTo(oArr, 0);
combobox1.Items.AddRange(arr);
|
|
|
|
|
I am creating a snake game on the console (c#)(it is a school assignment and it has to be on console) but I’m struggling with the change of direction and this is because I can’t figure out how to use an eventhandler with keydown properly in console.
I’ve put together some mock up code below which more or less explains what I try to accomplish
I have tried several things but it is tricky to do on the console.
Any hints, suggestions would be greatly appreciated.
void KeyDown(object sender, EventArgs e)
{
if(e.thepressedkey == Right.Arrow)
method_a()
if(e.thepressedkey == Left.Arrow)
method_b()
}
void a()
{
while(something)
{
snake.moveright();
thread.sleep(500);
}
}
void b()
{
while(something)
{
snake.moveleft ();
thread.sleep(500);
}
}
|
|
|
|
|
You would need something along the lines of:
bool GameIsOn = true;
while (GameIsOn)
{
if (Console.KeyAvailable)
{
ConsoleKeyInfo key = Console.ReadKey(true);
switch (key.Key)
{
case ConsoleKey.LeftArrow:
{
}
case ConsoleKey.RightArrow:
{
}
case ConsoleKey.UpArrow:
{
}
case ConsoleKey.DownArrow:
{
}
case ConsoleKey.Escape:
{
GameIsOn = false;
}
default:
{ }
}
}
}
If the post was helpful, please vote, eh!
Current activities:
Book: Devils by Fyodor Dostoyevsky
Project: Hospital Automation, final stage
Learning: Image analysis, LINQ
Now and forever, defiant to the end.
What is Multiple Sclerosis[ ^]?
|
|
|
|
|
Hi thanks!
I have actually tried that and that is almost what a want, however I'd like it to tick.
With this method you have have to press once for each step. I would like to start a loop of steps that loops until another directional key is pressed.
Any more thoughts?
|
|
|
|
|
Pffft!
You got me interested in writing the game myself now!
I'll probably post it as an article in a week or so.
But the way I'd do it is as follows:
void RunGame()
{
while (GameIsOn)
{
if (Console.KeyAvailable)
{
ConsoleKeyInfo key = Console.ReadKey(true);
switch (key.Key)
{
case ConsoleKey.LeftArrow:
CharacterDirection = Direction.Left;
break;
case ConsoleKey.RightArrow:
CharacterDirection = Direction.Right;
break;
case ConsoleKey.UpArrow:
CharacterDirection = Direction.Up;
break;
case ConsoleKey.DownArrow:
CharacterDirection = Direction.Down;
break;
case ConsoleKey.Escape:
GameIsOn = false;
break;
default:
break;
}
#endregion
}
AdvanceStep();
CheckCollision();
Thread.Sleep(100);
}
}
Now in the AdvanceStep() method you're going to have calculate the new position of the cursor and Console.Write() the new character placeholder. This will "tick" in the sense that you will see the character move in whatever direction you first choose, ten steps in 1 second. You can make that faster or slower based on the number of milliseconds you let that thread sleep.
There are things that you have to bear in mind. The Character's initial position [ (0,0) vs centre point ] the character's initial direction and so on. If for example you set the initial position at (0,0) and the initial direction is Right, then the character will move to the right (x-axis change only) until a button is pressed that will alter the direction.
If there are many attributes that you would like to add to your character, such as the length of the tail (we are talking about a snake-clone, right?), and also a history of the turns that were made (so that the tail will also turn at the correct locations) you might want to break into a class and if the list of positions can be lengthy (as can easily happen on a "big screen" with an expert player) then you might want to break that into its own vector class list.
If you have anymore questions, post some code as well, and we'll see how we can help you with where you are stuck
If the post was helpful, please vote, eh!
Current activities:
Book: Devils by Fyodor Dostoyevsky
Project: Hospital Automation, final stage
Learning: Image analysis, LINQ
Now and forever, defiant to the end.
What is Multiple Sclerosis[ ^]?
|
|
|
|
|
Very nice thanks alot, yes I have solved most problems with the tail, borders food etc.
Thanks for spending the time on it!!
|
|
|
|
|
Glad to have helped
If you have anymore questions, we, and especially I, will be glad to help.
Check back in a week or so and see if I posted the article by then, then you can compare notes
Best of luck with your assignment.
If the post was helpful, please vote, eh!
Current activities:
Book: Devils by Fyodor Dostoyevsky
Project: Hospital Automation, final stage
Learning: Image analysis, LINQ
Now and forever, defiant to the end.
What is Multiple Sclerosis[ ^]?
|
|
|
|
|
Hi everyone.
This is probably something I should be able to figure out by myself, but I'm not having much luck so I figured I'd ask.
The issue: I'm translating a system from java to C# and they use a java framework[^] that I'd really like to use, since it takes care of the most complex parts of the system, which I would otherwise have to implement myself. I have the source code of this framework.
I know there are several possibilities for using java libraries in C# (although I'm not familiar with any of them, so I'd appreciate suggestions). So far I've thought of using IKVM.NET[^] to generate a .dll, but I'm not sure what to do next, because in java in order to run the framework with your code you're supposed to use the option -javaagent[^] by adding
-javaagent:bin/deuceAgent.jar (where deuceAgent is the framework) to your java command line. I don't know what the equivalent in C# would be once I have my .dll, or whether there's an equivalent at all.
Any help? Thanks so much.
|
|
|
|
|
Hi all,
can anybody help me out here by providing me a solution.
I want to set a focus to masked TextBox control displayed over a cell in CellBeginEdit event.
MaskedTextbox.focus() is not working here
can anybody help me out ???
|
|
|
|
|
Do it using gridviews findcontrol method.
|
|
|
|
|
I have already tried that but no success
Control[] ctrl = datagridview.Controls.Find("name of textbox", true);
ctrl[0].Focus();
|
|
|
|
|
Try it like this.
MaskTextBox mt=datagridview.row[0].FindControl("nameof textbox")
mt.setFouus().
Hope this works.
|
|
|
|
|
there is no funciton like FindControl for datagridview
and there's no function like setFocus() for maskedtextbox
so r u serious in giving this solution?
|
|
|
|
|
sorry for the late reply. But i just did the same.
t1 = GridView1.Rows(0).FindControl("InstallmentDec")
t1.Text = dt.Rows(0)(12).ToString()
Its working for me.
Here use Foucus function in place of setting text will work fine.
|
|
|
|
|
Hi,
there is a stored procedure in Oracle that has a output parameter of type table of records.
What OracleType to use in C# to retrieve it?
Regards,
Adrian
|
|
|
|
|
|
|
|
In addition to SaMartens answer, if you are using .NET 3.5, you can use XDocument.Parse
|
|
|
|
|
i have created a CSV file with following format
"Test1";"Test2";"Test3"
when i tried to read that csv in Notepad using C#.net i am getiing with following format
"""Test1"";""Test2"";""Test3""" is there any way to resolve this
|
|
|
|
|
Hi,
what do you mean by "read that csv in Notepad using C#"? Maybe you could post the piece of code doing this?
Regards
Sebastian
|
|
|
|