|
Sweet, Thx! And It works very well in Windows, but my Gentoo died
|
|
|
|
|
hohsin01@yahoo.com.sg or hohsin10@hotmail.com
What's bad??? Pls help me, I do not have techar. Yor are ONE. Thanks!!!
Error 1 The type or namespace name 'IBankAccount' could not be found (are you missing a using directive or an assembly reference?) C:\Documents and Settings\Administrator\My Documents\Visual Studio 2005\Projects\Test012\Test012\Program.cs 24 33 Test012
Error 2 The type or namespace name 'IBankAccount' could not be found (are you missing a using directive or an assembly reference?) C:\Documents and Settings\Administrator\My Documents\Visual Studio 2005\Projects\Test012\Test012\Program.cs 57 32 Test012
using System;
using System.Collections.Generic;
using System.Text;
using Wrox.ProCSharp.OOCSharp.BankProtocols;
using Wrox.ProCSharp.OOCSharp.VenusBank;
using Wrox.ProCSharp.OOCSharp.JupiterBank;
namespace Wrox.ProCSharp.OOCSharp.BankProtocols
{
public interface IBanAccount
{
void PayIn(decimal amount);
bool Withdraw(decimal amount);
decimal Balace
{
get;
}
}
}
namespace Wrox.ProCSharp.OOCSharp.VenusBank
{
public class SaverAccount : IBankAccount
{
private decimal balace;
public void PayIn(decimal amoount)
{
balance += amount;
}
public void Withcraw(decimal amoount)
{
if (balance >= amount)
{
balance -= amount;
return true;
}
Console.WriteLine("Writdraw attemp failed");
return false;
}
public decimal Balanc
{
get
{
return balace;
}
}
public override string ToString()
{
return String.Format("Veuns Bank Saver : Balace = (0,6:C)", balance);
}
}
}
namespace Wrox.ProCSharp.OOCSharp.JupiterBank
{
public class GoldAccount : IBankAccount
{
//Console.WriteLine("Writdraw attemp failed");
}
}
namespace Test012
{
class Program
{
static void Main(string[] args)
{
IBankAccount venusAccout = new SaverAccout();
IBankAccount jupiterAccount = new GoldAccount();
venusAccount.PayIn(200);
venusAccount.Withdraw(100);
Console.WriteLine(venusAccount.ToString());
jupiterAccount.PayIn(500);
jupiterAccount.Withdraw(600);
jupiterAccount.Withdraw(100);
Console.WriteLine(jupiterAccount.ToString());
}
}
}
----------------------------------------------------------------------------
Help me, you are one!!!
Error 1 Invalid token 'interface' in class, struct, or interface member declaration C:\Documents and Settings\Administrator\Local Settings\Application Data\Temporary Projects\Test014\Program.cs 11 15 Test014
//Professional C# 2nd Edition -> Pg.128
using System;
using System.Collections.Generic;
using System.Text;
namespace Test014
{
class Program
{
pulic interface IBankAccount
{
void PayIn(decimal amount);
bool Withdraw(decimal amount);
decimal Balance
{
get;
}
}
public class CurrentAcconunt : ITransferAccount
{
private decimal balance;
public void PayIn(decimal amount)
{
balace += amount;
}
public bool Withdraw(decimal amount)
{
if (balance >= amount)
{
balance -= amount;
return true;
}
Console.WriteLine("Withdrawal attempt failed.");
return false;
}
public decimal Balance
{
get
{
return balance;
}
}
public bool TransferTo(IBankAccount destination, decimal anount)
{
bool result;
if((result = Withdraw(amount))== true)
destination.PayIn(amount);
return result;
}
public override string ToString()
{
return String.Format("Jupiter Bank Account: Balance = {0.6:C}", balance);
}
}
static void Main(string[] args)
{
IBankAccount venusAccount = new SaverAccount();
ITransferBankAccount jupiterAccount = new CurrentAccount();
venusAccount.PayIn(200);
jupiterAccount.PayIn(500);
jupiterAccount.TransferT(venusAccount,100);
Console.WriteLine(vernusAccount.ToString());
Console.WriteLine(jupiterAccount.ToString());
return;
}
}
}
|
|
|
|
|
Eddy Ho wrote: namespace Wrox.ProCSharp.OOCSharp.BankProtocols
{
public interface IBanAccount
{
void PayIn(decimal amount);
Do you see something wrong with this? A little spelling error perhaps?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Don't ever send an email to someone who doesn't ask you to. Keep this in the forums at all times.
Let me make it a little simpler. The error you're getting says that "The type or namespace name 'IBankAccount' could not be found".
Do you see something wrong here:
namespace Wrox.ProCSharp.OOCSharp.BankProtocols
{
public interface IBanAccount <<<<<<<----- CLUE !!!
{
void PayIn(decimal amount);
bool Withdraw(decimal amount);
decimal Balace
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
-- modified at 13:14 Saturday 14th January, 2006
|
|
|
|
|
Hello all!
I am using a C# program and would like to compress some files make zip file by coding. Can anyone provide some help. I look for msdn but not found.
Thanks All,
Tran Dung
-- modified at 21:49 Friday 13th January, 2006
|
|
|
|
|
|
Thanks for the reply but I figured it out. I have Visual C# 2005 Express and I had updated a project I had worked on several years ago. Anyway in looking thru the code I came across these 2 lines
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
I am not sure what the second one does, but the first one enables the xp styles. At least in Visual C# 2005.
|
|
|
|
|
Have you looked into MSDN[^]?
Sets the application-wide default for the UseCompatibleTextRendering property defined on certain controls.
|
|
|
|
|
I've create a form with some panel with an image as background, some textbox and label.
If load it all the controlls i just mentioned appear for a second black (during the painting event) then get the right aspect, panels show their picture, textbox and label their normal shape.
Why i get this? Programs like MSN that uses customized controls doesn't show them black.
(the problem i get also for normal controls)
I've tried yet using Backbuffer true.
|
|
|
|
|
Sasuko wrote: If load it all the controlls i just mentioned appear for a second black (during the painting event)
The painting event of what? Are you handling the painting event of the Panel control yourself? Are you using a large image (in bytes) for the background of the Panel control?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
they appear so during whatever pain event, on loading, if i resize the control and i hide for a little the control then i show it back, right in this moment the control is drawed again and i show its part in back...
If i run the program i want to see it all end drawed. Is it possible?
|
|
|
|
|
You didn't answer any of my questions.
But, what I think might be happening is your background image is being painted before your controls. Since your controls are drawn AFTER the background, the background is being drawn around the controls, leaving the black area for them to paint themselves into.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I have an old c#.net project, the first version of .net, that I converted to c# 2005. I would like to change the controls to xp style. They appear as xp controls in the editor but when I build it they are the old style. Thank you for any help.
Mike Deming
|
|
|
|
|
u have just to create a .manifest file ad place it in the same directory of application.
Serch google for indication how to create a file like this (you have just to copy and past the code and change a little)
Name the manifest with the same name of the application associated:
myprogram.exe.manifest
Regards
|
|
|
|
|
Use the Application.EnableVisualStyles() before calling the Application.Run() in your main function. Dont forget to set the flat style to your controls like buttons,group boxes and so.
|
|
|
|
|
Hi,
Is there any way to hide the blinking cursor?
Thanks!
Mel
|
|
|
|
|
Cursor.Hide() (See this[^])
If you are wnating to do this inside a textbox say (or any control), you can set its Cursor property in Winforms to "None".
Koushik Biswas
-- modified at 18:38 Friday 13th January, 2006
|
|
|
|
|
Ummmm...no, that hides the mouse pointer, not the blinking insertion point, what he called the "cursor".
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
IIRC, no there isn't. The insertion point can't be hidden on a control that can receive keystrokes.
I could be wrong though...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
<br />
[DllImport("user32.dll")]<br />
static extern bool HideCaret(IntPtr hWnd);<br />
Hides the caret temporarily.
Remember to include:
using System.Runtime.InteropServices;
Example:
<br />
HideCaret(richTextBox1.Handle);<br />
Hope this helps
|
|
|
|
|
Ahhh! I thought there might be something I was forgetting!
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
|
I would like to make the images concaternated and display it.
For example, I would like to put COUP images together and display them together. I can display the first image but am not able to display the second images.
How can I concaternate two images and display them together in c#?
Here is my tables:
Data table
Transactionid documenttype frontimage offset frontimage size
1934318415 CHECK 1 11264
1934318415 COUP 18433 27648
1934318415 COUP 57345 39936
The front/rear offset tell you where the image data in image table begins and the front/rear length tell you how many bytes from the offset to extract to get the image out of the Image table..
Image table
Transaction ID, Image
1934318415 <binary>
Here is the code:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Drawing;
using System.Data.SqlClient;
using System.IO;
using System.Drawing.Imaging;
using System.Collections.Generic;
public partial class GetImage : System.Web.UI.Page
{
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
_GetMultipleImages();
}
public void _GetMultipleImages ()
{
string TransactionId;
string sql;
byte[] imageBytes = null;
TransactionId = (string)this.Request.QueryString["TransactionId"];
if (TransactionId == null) return;
TransactionId = int.Parse(TransactionId).ToString();
sql = "Select Image from Image where TransactionId=" + TransactionId;
ConnectionStringSettings cnSetting =
ConfigurationManager.ConnectionStrings["AppConnectionString6"];
using (SqlConnection cn = new SqlConnection(cnSetting.ConnectionString))
{
using (SqlCommand cmd = new SqlCommand(sql, cn))
{
cn.Open();
using (SqlDataReader dr = cmd.ExecuteReader())
{
if (dr.HasRows)
{
dr.Read();
imageBytes = (byte[])dr["Image"];
}
}
}
}
if (imageBytes == null || imageBytes.Length == 0) return;
List<byte> imgBytes = new List<byte>();
using (SqlConnection cn = new SqlConnection(cnSetting.ConnectionString))
{
sql= "select FrontImageOffset, FrontImageSize,Rearimageoffset, RearImageSize from Image a join Data b on a.transactionid = b.transactionid where documenttype = 'CHECK' and b.TransactionId=" + TransactionId;
using (SqlCommand cmd = new SqlCommand(sql, cn))
{
cn.Open();
using (SqlDataReader dr = cmd.ExecuteReader())
{
if (dr.HasRows)
{
if (dr.Read())
{
long imagebytesLen = imageBytes.Length;
MemoryStream ImageStream = new MemoryStream(imageBytes);
do
{
int frontoffset = Convert.ToInt32(dr["FrontImageOffset"]) - 1;
int frontlength = Convert.ToInt32(dr["FrontImageSize"]);
int rearlength = Convert.ToInt32(dr["RearImageSize"]);
if (imagebytesLen >= (frontlength + rearlength))
{
byte[] newimage = new byte[frontlength + rearlength];
ImageStream.Seek(frontoffset, SeekOrigin.Begin);
ImageStream.Read(newimage, 0, newimage.Length);
imgBytes.AddRange(newimage);
}
} while (dr.NextResult());
ImageStream.Close();
}
}
dr.Close();
}
}
}
if (imgBytes.Count > 0)
{
Bitmap bmp = new Bitmap(new MemoryStream(imgBytes.ToArray()));
Response.ContentType = "Image/gif";
bmp.Save(Response.OutputStream, ImageFormat.Gif);
Response.End();
}
}
}
|
|
|
|
|
I want to create a multiplayer boardgame which allows players to either connect to a central server and join a game, or to host their own game and have their computer act as a private server. Security is also a high priorty for me, since I plan on creating a points system which leads to prizes, etc, so I don't want anyone to be able to cheat. So my question is: is C# the right language for this?
I've done most of my programming in C++ and Java in the past. Most of my applications have been computational or console apps, so I've never really gotten into GUI design (though I've done some basic swing and a little mfc). Likewise, I've never done anything at all with regards to network programming and setting up client/server applications.
I'm new to C# (all I know right now is from the FAQ on this forum), and it seems like what I want to use, but I'm not sure. Would you recommend it over say C++ and/or Java?
|
|
|
|
|
Dear .Net provide a hell lot easire classes for network programming and the graphics related work u want to do + you cant use Crypto Classes to encrypt ur messages to send and receive from the peers.
Dotn worry. Just Go Ahead.
Cheers,
Best Regards,
Rizwan
|
|
|
|