|
Thanks a million. It worked.
|
|
|
|
|
You are wellcome!
I'm glad I could help!
|
|
|
|
|
hi the program i am using for remoting has an configuration file which stores the port number and etc..
RemotingConfiguration.Configure(Application.StartupPath + "\\Client.exe.config",false);
the above is the where the program initialized the remoting with the configuration file..
however i am now trying to change the ip of the server
does anyone know how to set the ip portion of the server programically in the client while the other configuration is set in the configuration file?
thx
|
|
|
|
|
Something like this
ChannelServices.RegisterChannel(new TcpClientChannel(), false);<br />
Activator.GetObject(typeof(NetTime.NetTime), "tcp://localhost:8086/Time") as NetTime.NetTime;<br />
led mike
|
|
|
|
|
Hi All,
In my 3 tier application, I have a business object called a "machine", which has various simple properties such as Name and Asset Number. It also has properties consisting of other objects such as List<meters>MeterReadings and Model ModelInfo
In order to construct the "machine" object, my BLL dials into the DAL (and thence the Database), which then returns a Machine. Subsequently, the BLL dials back into the DAL to fetch the list of Meters and then adds these to the Machine's MeterReadings property, and then the BLL dials into the DAL once more to fetch a Model object and applies this to the Machine's ModelInfo property.
In effect, what I have here is the "parent" Machine object being constructed in the DAL, whilst the BLL then manages the addition of the "child" objects.
I'm not 100%, but I think I'm going about this the wrong way, as it seems quite messy - and I can certainly see that a more complicated object (with more sub objects-as-properties) could become quite unwieldy and difficult to debug.
Could anyone recommend a better method of acheiving this? For example, would it be better to make each Business Object (in my case the parent "Machine") responsble for all of its sub-objects?
Cheers,
Martin.
|
|
|
|
|
It is difficult to convey how, over the years, you easily perceive the structure your application requires. But it's all by rules/observations. Strive to conceive of the structure you need to build by perceiving where the best place is for each thing it needs to do. In effect, objects or classes design themselves if you let the job dictate the object.
In the end, there is no such thing as a "bad" class, simply because the class involves many objects or properties. Neither is there a real metric you should follow -- how big should a class be, or what are too many instance methods or members for instance? The size of the best defined objects is predicated by doing the job the best way it can be done. A lot of your work then is refining classes. You see that you will benefit if you split your large object up into smaller objects; or you see that you accomplish an important goal better by incorporating a further method. Always however, the job dictates class design. Concentrate on doing the job(s) the best they can be done, and you will build the best classes.
|
|
|
|
|
I am creating a C# app that needs to display a message on the screen even if the app itself is not in the foreground. When I use either a MessageBox or a form for the message, this message is always behind another unrelated application on the desktop. I need to bring this messagebox/form to the front all the time no matter what.
I have tried several of the form properties/methods and nothing has worked - (TopMost, BringToFront, Activate).
Does anyone know of a way to do this?
Thanks,
David
|
|
|
|
|
|
Try this..This is how i did...
call this function
BringEditorToFront(this); in ur Load..
This is the implementation of BringEditorToFront
private void BringEditorToFront(object objAttached)<br />
{<br />
<br />
<br />
Form parentForm = null;<br />
UserControl control = objAttached as UserControl;<br />
if (control == null)<br />
{<br />
parentForm = objAttached as Form;<br />
}<br />
else<br />
{<br />
parentForm = control.Parent as Form;<br />
}<br />
<br />
if (parentForm == null)<br />
return;<br />
<br />
int handle = 0;<br />
try<br />
{<br />
handle = (int)parentForm.Handle;<br />
}<br />
catch (Exception ex)<br />
{<br />
<br />
handle = 0;<br />
}<br />
if (handle != 0)<br />
SetForegroundWindow(handle);<br />
}<br />
<br />
<br />
public static bool SetForegroundWindow(int hWnd)<br />
{<br />
return Acc.Win32InteropLib.Win32Interop.SetForegroundWindow(hWnd);<br />
}
|
|
|
|
|
Thanks for both of your help.
I got it to work using the MessageBoxIndirect class as suggested by LedMike.
|
|
|
|
|
hi all,
anybody knows how to create xml attribute in c# with single quotation instead of double quotation as norm. Example :
|
|
|
|
|
Look at XmlTextWriter.QuoteChar
|
|
|
|
|
Hi guys,
does anybody know how to send SMTP mail in exchange 2003? I have my code working on 2000 but fails on 2003. Please help?
sasa
|
|
|
|
|
Hi friends,
Can anyone of u give me code example to make it clear that string is a reference type.
|
|
|
|
|
Hello,
string oldtest = "test";
object o = oldtest;
string newtest = o as string;
Would not be possible with an value type!
All the best,
Martin
|
|
|
|
|
Moreover strings have some interesting features.
string s1="Hi";
string s2="Hi";
Both s1 and s2 will point to same location.
Again if you say s2="Bye", memory is allocated of "Bye" and s2 will point to the new location.
Try to search on mutable and immutable properties of string.
That will give you a clear idea of strings..
Regards,
Arun Kumar.A
|
|
|
|
|
Tahnks a lot..ur reply(short and sweet) helped me a lot..
|
|
|
|
|
Hi,
Im trying to print out an image, but if it doesnt fit onto one page, i cut it up and place what evers left onto the next page.
Bitmap tempImage = new Bitmap(image, tempSize);<br />
RectangleF origRects = new RectangleF(0, 0, image.Width, image.Height);<br />
e.Graphics.DrawImage(tempImage, tempRect, origRects, GraphicsUnit.Pixel);<br />
<br />
if (tempImage.Height >= e.MarginBounds.Bottom)<br />
{<br />
int newHieght = tempImage.Height - e.MarginBounds.Bottom;<br />
<br />
tempRect = new RectangleF(0, newHieght, tempRect.Width, newHieght);<br />
tempSize = new Size((int)tempRect.Width, (int)tempRect.Height);<br />
<br />
e.HasMorePages = true;<br />
return;<br />
}<br />
<br />
e.HasMorePages = false;
The problem is that i draw the first page fine, but the second page, the image is the correct height, but instead of drawing the bottom half, it draws the top half of the image and cuts of what should be drawn.
Obviously, the cords are wrong, but what do i need to change?
regards,
Gareth.
|
|
|
|
|
Have you looked at Graphics.TranslateTransform ?
|
|
|
|
|
Hi friends,
why we are not using new keyword with string..
|
|
|
|
|
When creating new strings, you use the new keyword. Example:
string s1 = new String('-', 42);
When assigning a string literal, you are not really creating a new string object, just using a string object that already exists as a constant in the code. Example:
string s2 = "Hello world!"
When creating a new string by using a method that returns a string, the creation is done in the method, so you don't use the new keyword. Example:
string s3 = s2.ToLower();
When creating a new string by concatenating other strings, you are really using the String.Concat method. The + operator is shorthand for calling String.Concat. Example:
string s4 = s2 + s3;
string s5 = String.Concat(s2, s3);
---
single minded; short sighted; long gone;
|
|
|
|
|
Same reason we aren't using the new keyword with int, double, etc.: the value is often specified in-line; the new keyword would be unnecessary cruft.
Under the hood, of course, we are allocating a new string.
|
|
|
|
|
Hi,
Presumably this is a common enough problem, but I can't seem to find a neat way of doing it!
The problem is I need to convert a .doc file to a .pdf, on the server side - so I can't automate Word to do it (yes I'm aware it can be done with Office2007, which I have, but this app will have to be left unattended - this is not the designed use for Word).
Does anyone know of any open source tools that would be able to do this?
Thanks
What if the Hokey Kokey IS what it's all about?
|
|
|
|
|
Hi friends,
As System.Int32 is a struct(value type) while Object is a class..and its been said that Object is a base class for dot net classes..well its true bcoz even integer object shows all the properties and methods of object class..Now my Question is that whether stuct(System.Int32 here) can inherit any Class(object here)...?though its been clearly said that structs can not be inherited.
Reply Soon..Plz
|
|
|
|
|
Yes, System.Int32 is a struct. If you treat it as an object:
object o = 5;
An operation known as boxing occurs: new memory is allocated to hold an object, and the value of the integer is copied from the stack to the heap.
Search this site for articles on value and reference types for more info.
|
|
|
|