|
What protocol are you using to connect the client to the server? I'm mean have you written your own webserver, or some custom protocol on top of TCP/IP, or what?
Do you want to know more?
Vogon Building and Loan advise that your planet is at risk if you do not keep up repayments on any mortgage secured upon it. Please remember that the force of gravity can go up as well as down.
|
|
|
|
|
I use TCP Client class in the C# client program to connect to the server. I use the accept method in the c-written server to accept the incoming socket connection.
|
|
|
|
|
Hi,
my query is two-fold. Firstly, when exporting a datagrid (filled with Oracle data) to Excel the resulting .xls file is quite large(at least 6 MB) and is quite a slow load into Excel. I was wondering how to make it smaller (and quicker to load). Each query is about 6000 rows at least, all of which are required.
Secondly, can I export it to any other format other than .xls? I am able to produce .xml files but would like to produce .csv files if possible? Smaller .xls files would be perfect.
The saveFileDialog1.Filter method currently contains .xls as when I've tried to include .csv the file is written as Xml, is over 65000 lines and is therefore truncated by Excel.
I'm sure its just sloppy coding on my part (trainees eh?) so any advice/tips would be appreciated.
Thanks for reading
Scott
|
|
|
|
|
Hi,
I am trying to implement a list box in which each item is a button control with bitmap.
How can this be done?
Thanks
kalpu
|
|
|
|
|
Hello
Can anybody provide me code that how we can use our personal computer (running windows 2000, C#) as a FTP server.
I am a fresher in this Topic.
So please make the code simple.
Thanks
Sharad
|
|
|
|
|
You want to do it programmatically or manually?
Manual solution:
Install IIS on windows 2000. That will install SMTP and FTP services. Just enable the FTP service and your computer is a FTP server.
Programmatic Solution:
See whether System.Net.WebClient solves your purpose.
|
|
|
|
|
Hello,
I already have spoken about my problem in this forum. I developed a Smart Device Application with a Login function. After the login function a screen with some information is displayed for about five seconds and then be automatically forwarded to the next Form. I wrote a little code sample and wouuld ask if this is correct to solve my problem?
using System.Drawing;
using System.Collections;
using System.Windows.Forms;
using System.Data;
namespace SmartDeviceApplication2
{
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.MainMenu mainMenu1;
private static AutoResetEvent evt;
private static int count = 5;
public Form1()
{
InitializeComponent();
}
protected override void Dispose( bool disposing )
{
base.Dispose( disposing );
}
#region Windows Form Designer generated code
private void InitializeComponent()
{
this.mainMenu1 = new System.Windows.Forms.MainMenu();
this.textBox1 = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.button1 = new System.Windows.Forms.Button();
this.label2 = new System.Windows.Forms.Label();
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(64, 64);
this.textBox1.Text = "textBox1";
//
// label1
//
this.label1.Font = new System.Drawing.Font("Monotype Corsiva", 18F, System.Drawing.FontStyle.Italic);
this.label1.ForeColor = System.Drawing.Color.LawnGreen;
this.label1.Location = new System.Drawing.Point(16, 8);
this.label1.Size = new System.Drawing.Size(160, 24);
this.label1.Text = "Test";
this.label1.TextAlign = System.Drawing.ContentAlignment.TopCenter;
//
// button1
//
this.button1.Location = new System.Drawing.Point(64, 136);
this.button1.Text = "button1";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// label2
//
this.label2.Location = new System.Drawing.Point(64, 104);
this.label2.Text = "label2";
//
// Form1
//
this.BackColor = System.Drawing.Color.Orange;
this.Controls.Add(this.label2);
this.Controls.Add(this.button1);
this.Controls.Add(this.label1);
this.Controls.Add(this.textBox1);
this.Menu = this.mainMenu1;
this.Text = "Form1";
}
#endregion
static void Main()
{
Application.Run(new Form1());
evt = new AutoResetEvent(false);
Timer t = new Timer(new TimerCallback(TimerCallback), null, 5000, 0);
evt.WaitOne();
ActiveForm = Form2;
}
private void button1_Click(object sender, System.EventArgs e)
{
label2.Text = textBox1.Text;
tw.Write("This is the first message!");
}
private static void TimerCallback(object state)
{
evt.Set();
}
}
}
Thanks in Advance
regards
mathon
|
|
|
|
|
Hello,
I want to develop my own control for table which contains links which
referes to other Forms of a Smart Device Application for PocketPc. Does there any code samples exist which show such a development?
thx
regards
patrick
|
|
|
|
|
How do you create a user control by name in code.
Say I read in control names from a file. How do I then create them in code. In VB6 there was a CreateObject method but I can't find anything similar in C#
|
|
|
|
|
|
Thanks Stefan,
I used the Activator class to create the user control by assembly name and user control namespace and name e.g.
public static object CreateOject(string AssemblyPathName, string NamespaceClass)
{
Assembly assembly;
//Can be used when instance in another assembly
try
{
assembly;= Assembly.LoadFile(AssemblyPathName);
}
catch (System.IO.FileNotFoundException e)
{
throw an exception
}
System.Type TypeToCreate = assembly.GetType(NamespaceClass);
if (TypeToCreate == null)
{
throw an exception;
}
return Activator.CreateInstance(TypeToCreate);
}
Note you don't have to create the assembly object if the type is part of the same assembly or GAC, you can just get the Type by:
Type TypeToCreate = Type.GetType(NamespaceClass);
|
|
|
|
|
Hello,
I found the following code sample to create Image Buttons for PocketPc. The problem is i do not really know how to use it. means how to create an Image Button with this code sample...?
using System;
using System.Drawing;
using System.Windows.Forms;
using System.Drawing.Imaging;
namespace Sample
{
public class ImageButton : Control
{
private Image image;
private bool bPushed;
private Bitmap m_bmpOffscreen;
public Image Image
{
get { return image; }
set { image = value; }
}
public ImageButton()
{
bPushed = false;
this.Size = new Size(21, 21);
}
protected override void OnPaint(System.Windows.Forms.PaintEventArgs e )
{
Graphics gxOff;
Rectangle imgRect;
Brush backBrush;
if (m_bmpOffscreen == null)
m_bmpOffscreen = new Bitmap(ClientSize.Width, ClientSize.Height);
gxOff = Graphics.FromImage(m_bmpOffscreen);
gxOff.Clear(this.BackColor);
if (!bPushed)
backBrush = new SolidBrush(Parent.BackColor);
else
backBrush = new SolidBrush(Color.LightGray);
gxOff.FillRectangle(backBrush, this.ClientRectangle);
if (image != null)
{
int imageLeft = (this.Width - image.Width) / 2;
int imageTop = (this.Height - image.Height) / 2;
if (!bPushed)
imgRect = new Rectangle(imageLeft, imageTop, image.Width, image.Height);
else
imgRect = new Rectangle(imageLeft + 1 , imageTop +1, image.Width,
image.Height);
ImageAttributes imageAttr = new ImageAttributes();
imageAttr.SetColorKey(BackgroundImageColor(image),
BackgroundImageColor(image));
gxOff.DrawImage(image, imgRect, 0, 0, image.Width, image.Height,
GraphicsUnit.Pixel, imageAttr);
}
if (bPushed)
{
Rectangle rc = this.ClientRectangle;
rc.Width--;
rc.Height--;
gxOff.DrawRectangle(new Pen(Color.Black), rc);
}
e.Graphics.DrawImage(m_bmpOffscreen, 0, 0);
base.OnPaint(e);
}
protected override void
OnPaintBackground(System.Windows.Forms.PaintEventArgs e )
{
}
protected override void OnMouseDown ( System.Windows.Forms.MouseEventArgs e )
{
bPushed = true;
this.Invalidate();
}
protected override void OnMouseUp ( System.Windows.Forms.MouseEventArgs e )
{
bPushed = false;
this.Invalidate();
}
private Color BackgroundImageColor(Image image)
{
Bitmap bmp = new Bitmap(image);
return bmp.GetPixel(0, 0);
}
}
}
|
|
|
|
|
I would like to store an image in an SQL Server database and load it into a picture box.
Has anyone had experience with doing this before?
An example would be appreciated.
Thanks
Stephen
|
|
|
|
|
I would usually store the address of picture in the database instead of image itself, you can do this too unless you don't want your pictures stored in folders.
|
|
|
|
|
HI~
I am writing a program to send email using simple mapi.
When I use the MAPISend to send the email, the new mail is not sent actually. The mail is just put on the outbox of the outlook express. Also the MAPIFindNext method also just get the mail from the inbox of the outlook express but not get the mail from the internet email server. Only when I download the email by using outlook express, my program can get the new mail.
Can I automate the sent process and the receive process so that the email is actually sent and the new mail can be retrieved from the internet server by press the button of my program by using Simple mapi?
|
|
|
|
|
simply i want to know how to add two integer numbers in C#. i'd appreciate your help guys.
|
|
|
|
|
int firstInt = 3;
int secondInt = 2;
int result ;
result = firstInt + secondInt;
The + operator will add together most any of your basic types: int, long, short, string, etc. Hope that helps.
Quantum materiae materietur marmota monax si marmota monax materiam possit materiari?
|
|
|
|
|
but here you arleady assigned values to the two integers, what I need is to make a program that takes two input numbers from user and then adds them. thx a lot for ur reply anyway.
|
|
|
|
|
Class abc
{
int a=System.Console.ReadLine();
int b=System.Console.ReadLine();
int c=a+b;
}
/\ |_ E X E GG
|
|
|
|
|
Well does it need to be a console application or a Windows Forms application? Or even an ASP.NET application? The basic principle remains the same...it's just a matter of gathering that input from the user.
Quantum materiae materietur marmota monax si marmota monax materiam possit materiari?
|
|
|
|
|
How about voice recognition? That'd be cool
--
Help me! I'm turning into a grapefruit!
Phoenix Paint - back from DPaint's ashes!
|
|
|
|
|
Even better, thought recognition. The ultimate lazy mans computer.
|
|
|
|
|
It looks like you want to add two numbers
Would you like help?
- Get help thinking of a number
- Just carry on adding without help
Oh god...
--
Help me! I'm turning into a grapefruit!
Phoenix Paint - back from DPaint's ashes!
|
|
|
|
|
And since it's a thought computer, the thing is going to project an image of Clippy directly into my optical nerves. Great.
Quantum materiae materietur marmota monax si marmota monax materiam possit materiari?
|
|
|
|
|
Hi,
I have to write an application which extensively uses an SQL Database. For a simple example say I have the following tables with the appropriate fields.
1. Company (ID, Name, AddresseInfoID)
2. AddresseInfo (ID, Street, City, Zip)
(Those two obviously have a relationship)
Now I'd go and create an object called Company and one for the AddresseInfo. AddresseInfo would be a public member of Company.
Usually you'll have more than one company to manage so I create a strongly typed collection called CompanyCollection.
Now on to the questions:
1. Should each individual object be responsible of loading and saving it's data from and to the database or should the CompanyCollection take care of it (which IMHO seems a lot less coding to me on first sight)?
2. Assumed the Collection takes care of the data-fetching, how should then the data changes whithin the individual objects be handled? What comes in mind is either a IsDirty property of each of the BusinessObjects (Company and AddresseInfo) (which can be checked by the collection) or an event (say DataChanged) to which the collection would hook up.
The problem I see with this approach is the following. Say my MDI GUI displays a list of all Companies in a TreeView on the lefthandside. On DoubleClick the selected BusinessObject gets displayed in a new "Document Window" which hosts a PropertyGrid control. Now my user opens 3 Companies and changes the data of all of them. How would I then handle the situation when he only wants to save to of those documents?
Here is some additional information which I feel might be usefull:
a. The amount of BusinessObject loaded from the Database is never really huge. Say a maximum of 2000 objects.
b. BusinessObjects might contain collections of other BusinessObjects, e.g. the Company object will contain a EmployeeCollection.
c. The amount of different BusinessObjects will probably not exceed 20.
d. Performance issues are not a knock out criteria.
e. The solution that I'm after is simple to code and maintain. I don't actually want to create a huge Framework with hundrets of classes which provide for unlimited scalability and the forth. We are talking about an application which is used by 10 people and new versions can be installed at any time if required.
I hope someone can give me some advice on how to design this properly.
Thanks in advance,
Matthias
If eell I ,nust draw to your atenttion to het fakt that I can splel perfrectly well - i;ts my typeying that sukcs.
(Lounge/David Wulff)
|
|
|
|