|
If I set the paper size of the dialog to "US Index Card 5x8" (one of the options in the Page Size dropdown list), then open the dialog, "Letter" is selected for the Page Size. See code below:
pageSetupDialog = new PageSetupDialog();
pageSetupDialog.Document = new PrintDocument();
pageSetupDialog.PageSettings.PaperSize = new PaperSize("US Index Card 5x8", 500, 800);
DialogResult result = pageSetupDialog.ShowDialog();
Even if I select "Letter" or "Legal" in the dialog box and click OK, pageSetupDialog.PageSettings.PaperSize is still set to the custom size, NOT Letter as it should be.
Is this a bug? Please help.
|
|
|
|
|
Hi,
I am using the following code for testing purposes:
public class VariousTests
{
public static void Main(string[] args)
{
AClass c = new AClass();
int y = c.DemandSupplyMatrix[0, 0];
}
}
class AClass
{
private int[,] _aMatrix = null;
public int[,] DemandSupplyMatrix
{
get
{
if (_aMatrix == null)
_aMatrix = new int[9, 4];
return _aMatrix;
}
}
}
I run it until I hit breakpoint 2 and I expect to see DemandSupplyMatrix being null in the debugger. Instead, it appears to have been already instantiated, and I have never hit breakpoint 1...
I really need to debug the getter but it seems that I have no chance.
Is this normal or am I missing something?
Bogdan.
|
|
|
|
|
Hi,
I tried this on VS 2008 C# Express, and you're right, breakpoints inside getters never get hit.
If you turn the getter into a normal method, it works fine.
Probably is a bug in VS, properties get translated in methods with a slightly different name...
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
It is also the suggestion of MS FxCop. Never use an array directly in a property. The suggestion is always change it to a method.
|
|
|
|
|
I was very surprised to see breakpoints work fine when the getter properties return a simple variable or a collection such as a List<int>, and they don't when the return type is an array. That doesn't make much sense to me.
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
hi, currently working on an internet cafe software which will be in client/server structure.Client and server will communicate in both ways(customers give orders from clients and server controls computers) and I am planning to use TCP sockets. So am I on the right direction? or what would be the best way? thanks in advance
a fast and stable connection type and your valuable comments would be nice
|
|
|
|
|
There is various way to do this... whatever I think for data transportation you should try web service...
Thanks
Md. Marufuzzaman
Don't forget to click [Vote] / [Good Answer] on the post(s) that helped you.
I will not say I have failed 1000 times; I will say that I have discovered 1000 ways that can cause failure – Thomas Edison.
|
|
|
|
|
to make it clear, my program will be used in one place.All clients and the server will be side by side. so why web service?
|
|
|
|
|
Well...TCP/IP socket is good for small transaction.... My point of view was the data transport mechanism.. you know HTTP over TCP/IP allow you to transfer data as xml format...which is much more reliable,secured.
Thanks
Md. Marufuzzaman
Don't forget to click [Vote] / [Good Answer] on the post(s) that helped you.
I will not say I have failed 1000 times; I will say that I have discovered 1000 ways that can cause failure – Thomas Edison.
|
|
|
|
|
Md. Marufuzzaman wrote: My point of view was the data transport mechanism
to get the best reply I think I have to be more specific. Things that I am planning to handle with the server part of the program are:
(program will be used in LAN with 27 computers)
- switch on/of client computers
- open/close customer accounts(keep records of passed/elapsed times and charges them to account
- always live connection to see if the client is connected or not
- sending small files to clients
(I don't care about security at all)
modified on Saturday, October 10, 2009 4:00 PM
|
|
|
|
|
here you go
An Asynchronous Socket Server and Client[^]
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKQUFK[M`UKs*$GwU#QDXBER@CBN%
R0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
-----------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
|
Could you please clarify... Why you are saying TCP is usually fine?
Thanks
Md. Marufuzzaman
Don't forget to click [Vote] / [Good Answer] on the post(s) that helped you.
I will not say I have failed 1000 times; I will say that I have discovered 1000 ways that can cause failure – Thomas Edison.
|
|
|
|
|
Well how often do you use UDP? And other protocols (like DCCP, SCTP, RSVP and ECN) are extremely rare
|
|
|
|
|
The other protocol SCTP is not rare. In Telecom, for Sigtran, SCTP is used.
|
|
|
|
|
|
hi,
Could someone please translate this code to vb.net ?
static string str= "OKVALUES";
static string encode(string s)
{
string strTest = "";
for (int i = 0; i < s.Length; i++)
{
byte b = (byte)s[i];
strTest += str[b >> 4];
strTest += str[b & 0xf];
}
return strTest ;
}
When you get mad...THINK twice that the only advice
Tamimi - Code
|
|
|
|
|
Why?
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
Shared str As String = "OKVALUES"
Private Shared Function encode(ByVal s As String) As String
Dim strTest As String = ""
For i As Integer = 0 To s.Length - 1
Dim b As Byte = CByte(s(i))
strTest += str(b >> 4)
strTest += str(b And &Hf)
Next
Return strTest
End Function
Used: http://www.developerfusion.com/tools/convert/csharp-to-vb/[^]
|
|
|
|
|
Dim b As Byte = CByte(s(i))
I think the above line will generate a compile error...like
'Char' values cannot be converted to 'Byte'.
Thanks
Md. Marufuzzaman
Don't forget to click [Vote] / [Good Answer] on the post(s) that helped you.
I will not say I have failed 1000 times; I will say that I have discovered 1000 ways that can cause failure – Thomas Edison.
|
|
|
|
|
I agree.
Dim b As Integer = Microsoft.VisualBasic.AscW(s(i)) should solve that.
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
Why downgrade perfectly good code
only two letters away from being an asset
|
|
|
|
|
I do agree...
Thanks
Md. Marufuzzaman
Don't forget to click [Vote] / [Good Answer] on the post(s) that helped you.
I will not say I have failed 1000 times; I will say that I have discovered 1000 ways that can cause failure – Thomas Edison.
|
|
|
|
|
Thank you all
When you get mad...THINK twice that the only advice
Tamimi - Code
|
|
|
|
|
Hi.
I want to compare two arraylists with each other, but not with the compare method.
That means, I have two computers with an arraylist on each of them. If the contents of these arraylists are the same, the calculated value from the arraylist should also be the same.
So is it possible to compare collections this way? MD5? Hash value? Checksum? Whatever!
Thanks alot
|
|
|
|