473,403 Members | 2,183 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

problem with C# class accessing

Aas Salamu Aalaikum

I’m facing a problem while using C#.NET class. I think my problem is very silly and most of the time I stuck in my programs for silly problems. (Most silly problems…!)

I create a class using C# and my problem is set the value in the class and getting the value from the class..!!! (I know its heard silly…!!) Whatsoever, my code isn’t working.

Here’s my class

using System;
using System.Collections;

namespace Proj_Puzzle_Game
{
/// <summary>
/// Summary description for CHighScore.
/// </summary>
public class CHighScore
{


public string[] Toplayers = new string[11]{ "None", "None", "None", "None", "None", "None", "None", "None", "None", "None", "None" };
public int[] TopScore = new int [11]{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};

public string singplay;
public int singscore;

int i, t;
string temp;

/* public class myReverserClass : IComparer
{

// Calls CaseInsensitiveComparer.Compare with the parameters reversed.
int IComparer.Compare( Object x, Object y )
{
return( (new CaseInsensitiveComparer()).Compare( y, x ) );
}

}
*/
public int SingleScore
{
get
{
return singscore;
}
set
{
singscore = value;
}
}

public string SinglePlayer
{
get
{
return singplay;
}
set
{
singplay = value;
}
}

public CHighScore()
{
//
// TODO: Add constructor logic here
//

//IComparer myComparer = new myReverserClass();

i=0;
while(i<11)
{
if(Toplayers[i]!= "None")//find a empty slot
i++;
else if(i==10)// while no empty slot found
{
Toplayers[i] = SinglePlayer;
TopScore[i] = SingleScore;
break;
}
else // insert into a empty slot
{
Toplayers[i] = SinglePlayer;
TopScore[i] = SingleScore;
break;
}
}
if(i==11)
i--;

//Insertion Sorting Algorithm
while(i>0)//according to previous position of i
{
if(TopScore[i]>TopScore[i-1])//if true lift it up
{
temp = Toplayers[i];
Toplayers[i] = Toplayers[i-1];
Toplayers[i-1] = temp;

t = TopScore[i];
TopScore[i] = TopScore[i-1];
TopScore[i-1] = t;
}
i--;
}
//Array.Sort(TopScore, Toplayers, myComparer);

}


// Sorts the entire Array using the default comparer.

}
}


And here’s my code for set the value for the class

CHighScore chigh = new CHighScore();

chigh.SingleScore = Score;

chigh.SinglePlayer = TxtLoginName.Text;

I’ve learnt C# from internet. The web site is www.functionx.com/csharp/

I also sending my whole project (I mean to say developing project, not finished yet !!!) if anyone like to see it.

Fee Aamanillah
May 7 '06 #1
0 1303

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Achim Domma (Procoders) | last post by:
Hi, I have a problem with a DCOM server written in python. Here is my minimal test object: class TestObject: _reg_clsid_ = "{ECDBB3BC-F0BF-4eef-87C0-D179A928DAB5}" _reg_progid_ =...
17
by: Dave | last post by:
Hi I'm making a 3D Engine which consists of the class C3DEngine. Part of this engine is a file loader, a class called CMeshLoader. I have made an instance of CMeshLoader in C3DEngine, ie...
3
by: debadeepti | last post by:
Hi All, I am porting an application from watcom to vc compiler. In watcom and other compiler (other then vc) memory allocation of __vfptr inside class object are different. In vc __vfptr is...
0
by: Lokkju | last post by:
I am pretty much lost here - I am trying to create a managed c++ wrapper for this dll, so that I can use it from c#/vb.net, however, it does not conform to any standard style of coding I have seen....
1
by: Eirik Brattbakk | last post by:
Hi I have some problems accessing a soap service made in c# using an ATL/MFC client over SSL. I have tried both CSoapMSXMLInetClient and CSoapWininetClient as template arguments with my stub...
29
by: Michael D. Ober | last post by:
Is there any way to create a constant in a class that can be used both with an instantiated object and without. For example: dim ClassConst as string = myClass.ConstantString dim myObj = new...
1
by: muthu | last post by:
Hi guys, Iam using dot framework 2.0.vs.net2005.I created a class library project and added a class file.And also i added a app.config file.And i declared a connection string in that config...
3
by: Jeff | last post by:
Hey asp.net 2.0 In the source I posted below, there is a GridView (look at the bottom of the script): <asp:GridView ID="gvwOnline" runat="server"> </asp:GridView> I'm trying to assign a...
4
by: GesterX | last post by:
Hi guys, this has been bugging me for a while and I'd appreciate any help anyone could offer. Basically I am running a boating simulation and I have all of the "harder" parts done but one error is...
3
by: djsuson | last post by:
I'm trying to set up an inheritance tree that also uses templates. This is an attempt to simplify some previous code that was filled with redundancies. I'm working with g++ 3.4.6. The code is split...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.