|
If you're determined not to use the server to do this, you'd have to create a new DataTable that contained the matching results from both sets, or use the techniques outlined here[^].
|
|
|
|
|
converting database schema in form of schema graph having primary and foreign key relationship and storing in cache using datastructure........?????????
|
|
|
|
|
Just throwing question marks at a sentence doesn't make this a question. What are you asking, and what have you written so far?
|
|
|
|
|
Visual Studio has tools where a table can be viewed as a schema diagram - if that is what you are looking for.
|
|
|
|
|
hey guys i'm making a ladder and snake game using C# and i'm stuck at the point where i need to move my players forward .. which means that the players move correctly only in round 1 but after that they start going backwards .
for example for player one the first turn the dice showed number 4 so it moved to square 4 , in second round the dice showed number 2 the player goes back to number two and not to number 6 as it's suppose to .. so can you help me with that i would really appreciate it
this is my code so far :
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 ladder__snake
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
//variables to hold the players locations
int blueposition = 1;
int redposition = 1;
int round = 0;
bool drawbg = false;
Point[] squares = new Point[26];
public void main()
{
//array for the squares
squares[0] = new Point(50, 450);
squares[1] = new Point(150, 450);
squares[2] = new Point(250, 450);
squares[3] = new Point(350, 450);
squares[4] = new Point(450, 450);
squares[5] = new Point(450, 350);
squares[6] = new Point(350, 350);
squares[7] = new Point(250, 350);
squares[8] = new Point(150, 350);
squares[9] = new Point(50, 350);
squares[10] = new Point(50, 250);
squares[11] = new Point(150, 250);
squares[12] = new Point(350, 250);
squares[13] = new Point(350, 250);
squares[14] = new Point(450, 250);
squares[15] = new Point(450, 150);
squares[16] = new Point(350, 150);
squares[17] = new Point(250, 150);
squares[18] = new Point(150, 150);
squares[19] = new Point(50, 150);
squares[20] = new Point(50, 50);
squares[21] = new Point(150, 50);
squares[22] = new Point(250, 50);
squares[23] = new Point(350, 50);
squares[24] = new Point(450, 50);
}
private void button1_Click(object sender, EventArgs e)
{
round++;
label3.Text = round.ToString();
//for the blue player dice
Random rnd;
int guess;
rnd = new Random();
guess = rnd.Next(1, 7);
pictureBox1.Image = Image.FromFile(guess.ToString() + ".png");
// Get the Blue player moving
switch (guess)
{
case 1:
bluePlayer.Location = new Point(50, 450);
break;
case 2:
bluePlayer.Location = new Point(150, 450);
break;
case 3:
bluePlayer.Location = new Point(250, 450);
break;
case 4:
bluePlayer.Location = new Point(250, 350);
MessageBox.Show("It's a ladder move to square 8");
break;
case 5:
bluePlayer.Location = new Point(450, 450);
break;
case 6:
bluePlayer.Location = new Point(450, 350);
break;
}
//bluePlayer.Location = squares[blueposition+guess];
//BluePlayer += guess;
//currentPosition1 += guess;
// bluePlayer.Location = squares[BluePlayer+guess];
//guess = 0;
label4.Visible = false;
label5.Visible = true;
label5.Text = "Red Player's turn";
button2.Enabled = true;
button1.Enabled = false;
pictureBox2.Image = Image.FromFile("dice.png");
//blueposition += guess;
//bluePlayer.Location = squares[guess];
}
private void button2_Click(object sender, EventArgs e)
{
//for the red player dice
Random rnd;
int guess;
rnd = new Random();
guess = rnd.Next(1, 7);
pictureBox2.Image = Image.FromFile(guess.ToString() + ".png");
//redposition += guess;
switch (guess)
{
case 1:
redPlayer.Location = new Point(50, 445);
break;
case 2:
redPlayer.Location = new Point(150, 445);
break;
case 3:
redPlayer.Location = new Point(250, 445);
break;
case 4:
redPlayer.Location = new Point(250, 350);
MessageBox.Show("It's a ladder move to square 8");
break;
case 5:
redPlayer.Location = new Point(450, 445);
break;
case 6:
redPlayer.Location = new Point(450, 345);
break;
}
label5.Visible = false;
label4.Visible = true;
label4.Text = "Blue Player's turn";
button2.Enabled = false;
button1.Enabled = true;
pictureBox1.Image = Image.FromFile("dice.png");
}
private void groupBox2_Enter(object sender, EventArgs e)
{
if (!drawbg)
{ groupBox2.Visible = true; }
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void Form1_Load_1(object sender, EventArgs e)
{
pictureBox1.Image = pictureBox2.Image = Image.FromFile("dice.png");
}
}
}
|
|
|
|
|
Your code needs to be formatted, click on Edit to make changes and then click on the format bar above the edit box and select code, and scroll down the list to select the programming language. Then move all your code inbetween the <pre > tags. </pre>
|
|
|
|
|
this program I am do it but there is an error into it ,the error is in the function ...gotoxy().the massege error is "gotoxy is undeclarated"...I am do this program by Visual Stadiue 2006...
the code:
#include<iostream.h>
class base
{private:
int n,i,j,h,x[10];
float fx[10][10];
static char c;
public:
void set(int cn,int ci,int cj,int ch,int cx,float cfx,char cc)
{
cn=n;ci=i;cj=j;ch=h;cx=x[10];cfx=fx[10][10];cc=c;
}
void show()
{cout<<"\n\t\t******\t THE DIFFREEN\t******";
cout<<"\n\n";
cout<<"\n ENTER THE NUMBER OF THE VALUSE OF X:";
cin>>n;
cout<<"\n\n ENTER THE FIRST VALUE OF X1:";
cin>>x[0];
cout<<"\n ENTER THE INTERVAL:";
cin>>h;
for(i=1;i<n;i++)
x[i]=x[i-1]+h;
cout<<"\n\n\n ENTER THE VALU OF F(X):";
for(i=0;i<n;i++)
{
cout<<"\n f("<<x[i]<<")=";
cin>>fx[i][0];
}
for(i=1;i<n;i++)
for(j=1;j<n-i+1;j++)
fx[j-1][i]=fx[j][i-1]-fx[j-1][i-1];
cout<<"\n\nX\tf(x)\t";
for(i=1;i<n;i++)
cout<<c<<i<<"f(x)\t";
cout<<"\n";
for(i=0;i<n;i++)
{gotoxy(3,i*3+4);
cout<<x[i];}
for(j=0;j<n-i;j++)
if(i+j<n)
{
gotoxy((i+1)*9,((j*3)+i+4));
cout<<fx[j][i];
}}
};
void main()
{base k;
k.show();
}
char base::c=30;
|
|
|
|
|
There are lots of mistakes.
for () {
and };
but fixing these won't make the other errors go away.
Your biggest problems are text layout. indent (3 or 4 spaces from the left edge)
for () {
doSomething();
a = b+c;
};
it helps if you create both open{ and closing braces }; at the same time and insert code between.
modified 15-May-13 15:57pm.
|
|
|
|
|
1) That's not C#, so you are in the incorrect forum
2) I don't think VC++ has any gotoxy(int, int) method in the libraries so you will probably need to make your own, see this:
http://www.cplusplus.com/forum/beginner/28859/[^]
If you think you can do a thing or think you can't do a thing, you're right - Henry Ford
Emmanuel Medina Lopez
|
|
|
|
|
Either you havent created a method call "gotoxy()" or you haven't included a library file (.h or .cpp) that contains the "gotoxy()" method.
Think! Don't write a line of code unless you absolutely need to.
|
|
|
|
|
im starting my work with c# and i have a problem with inheritance, i need one form to inherite after another one, it wouldnt be a problem but dialog class inherit after "Form", since in c# its only one inherit per class and dialog class cant run whitout "Form". how can i implement my own class into dialog class?
(sorry for my bad english)
|
|
|
|
|
I'm sorry, but I'm having trouble visualising what you are trying to do here. Could you show what you're trying to have as the inheritance chain?
|
|
|
|
|
i've made a variable
using /some headers/
namespace Project1
public partial class profil : Form
{
Rycerz gracz = new Rycerz();
/rest of code/
the wariable called gracz of class Rycerz, created in winform, i need to use this variable in other winform how can i inherit this in the other winform?
i hope its better now?
|
|
|
|
|
Okay, that's not inheritance. What you would be looking to do is either make this a public property or public field and have the other form access that if necessary. Now, if your other form is opened by this one, a better method would be to raise an event back to this form, and set the values based off that event. That way you stop the other form having to know about Rycerz.
|
|
|
|
|
well i dont understand exatly what you mean, make the variable gracz public? how do i make the other form to access it (i made variable public but still other form cant see it)? sorry for such noob questions.
|
|
|
|
|
I think you want something like this:
public class Child : System.Windows.Forms.Form
{
private int _privateField = 0;
public int PublicProperty
{
get { return(_privateField); }
set { _privateField = value; }
}
}
public class Parent : System.Windows.Forms.Form
{
private void SomeMethod
{
Child child = new Child();
child.PublicProperty = 42;
child.ShowDialog();
int processedValue = child.PublicProperty;
child.Dispose();
}
}
In the parent form, you create an instance of the child form and pass the initial integer value to it via its public property. The child form can then work with it in every way you can think of.
ShowDialog() is a blocking call. It returns when the child form closes. You can then still read from it until it is disposed. That way you can get the changed value of PublicProperty.
You can as well create multiple public properties. That could be necessary if child form's processing results in a value of different type than the input.
Ciao,
luker
|
|
|
|
|
You form would not inherit from form but would inherit from your base form. I THINK that's what you're trying to do. It's not clear at all.
A class can inherit from only one other base class, but that base class can itself inherit from some other class, like System.Windows.Form.
|
|
|
|
|
i will state it other way, i have a variable created in one form i need to use it in other form how can do that?
|
|
|
|
|
Make a public Property that returns the value.
|
|
|
|
|
You can make your own Dialog Form instead of trying to inherit from the existing class.
Or easier, your form can inherit from the Dialog class.
|
|
|
|
|
Hi Guys ,
Could you please let me know how to consume the following REST service from C# code. Your answers will be very helpful. Thanks in advance.
Authenticate(POST)
http://localhost:50448/UserRest/GetSampleMethod_With_OAuth
json script -Request Body
{
"Password":"subin",
"UserName":"Subin"
}
Get All(GET)
http://localhost:50448/UserRest/getall?token={token}
Update(PUT)
http://localhost:50448/UserRest/update?token={token}
json script -Request Body
{
"Bank":"String content",
"DOB":"String content",
"ID":"1",
"Name":"String content"
}
Delete(DELETE)
http://localhost:50448/UserRest/delete/1?token={token}
Logout(POST)
http://localhost:50448/UserRest/LogoutSession?token={token}
With Regards
|
|
|
|
|
|
Hey guys,
I have this weird problem, when I want to open the FolderBrowserDialog, I can't select any folder on my phone! When I want to select a folder on my local HDD, there's no problem, but when it comes to the phone the select button get's deactivated and I can't select a folder. (see attached picture)
Here's the code I'm using:
private void button3_Click(object sender, EventArgs e)
{
using (FolderBrowserDialog dialog = new FolderBrowserDialog())
{
dialog.Description = "Open Folder";
dialog.ShowNewFolderButton = true;
dialog.RootFolder = Environment.SpecialFolder.MyComputer;
if (dialog.ShowDialog() == DialogResult.OK)
{
textBox2.Text = dialog.SelectedPath;
}
}
}
What I want to do is copying my music to the phone, but therefore I need a path.
When I open the phone with Microsoft Explorer, the path is shown such as "Computer\GT-I9300\Card\Bluetooth" (that's the folder "Bluetooth" on the root of the external card of the phone). So there's no explicit path either! Is there any other way to get the path? Programs such as WinAmp or WMP can connect to the phone to copy files without any problems, so it must be possible somehow.
|
|
|
|
|
|
Instead of trying to type this up, which would take forever… I recorded my screen and uploaded it to YouTube.
Here is the link to the video:
[^]
using System;
namespace CalculatetothePowerof
{
class Program
{
static void Main()
{
AcceptValueOne();
}
static int AcceptValueOne()
{
Console.WriteLine("Enter your first number:");
string valueOne = Console.ReadLine();
int IntOne = 0;
bool result = Int32.TryParse(valueOne, out IntOne);
if (!result)
{
Console.WriteLine("Attempted conversion of '{0}' failed.", IntOne);
AcceptValueOne();
}
Console.WriteLine("\n{0}", IntOne + ", is what you entered?\n\nPress lowercase y for yes\nPress lowercase n for no.");
string yesNo = Console.ReadLine();
if (yesNo == "y")
{
AcceptValueTwo();
}
if (yesNo == "n")
{
Console.Clear();
AcceptValueOne();
}
else if (yesNo != null)
{
Console.Clear();
AcceptValueOne();
}
return IntOne;
}
static int AcceptValueTwo()
{
Console.WriteLine("\nEnter your second number:");
string valueTwo = Console.ReadLine();
int IntTwo = 0;
bool result = Int32.TryParse(valueTwo, out IntTwo);
if (!result)
{
Console.WriteLine("Attempted conversion of '{0}' failed.", IntTwo);
AcceptValueTwo();
}
Console.WriteLine("\n{0}", IntTwo + ", is what you entered?\n\nPress lowercase y for yes\nPress lowercase n for no.");
string yesNo = Console.ReadLine();
if (yesNo == "y")
{
CalcPowerOf();
}
if (yesNo == "n")
{
Console.Clear();
AcceptValueTwo();
}
if (yesNo != null)
{
Console.Clear();
AcceptValueTwo();
}
return IntTwo;
}
int valOne = AcceptValueOne();
int valTwo = AcceptValueTwo();
static void CalcPowerOf()
{
Program MyObj = new Program();
Console.WriteLine(Math.Pow(MyObj.valOne, MyObj.valTwo));
Console.Read();
}
}
}
When I changed this:
int valOne = AcceptValueOne();
int valTwo = AcceptValueTwo();
Into this:
int valOne = IntOne;
int valTwo = IntTwo;
Blue squiggly lines appear underneath both:
IntOne;
IntTwo;
Does not exist in the current context.
If you make any changes to my code, please explain what you're doing and why.
Thank you to all who took the time.
Rob
|
|
|
|
|