|
I want to change the outer border of tablelayoutpanel. NOT THE INNER CELL BORDER bt the OUTER BORDER of the panel.
Tablelayoutpanel has the option for cell borders bt not for the outer border. How to change that.????
Can anybody help me with the code....????
Thanks in advance....
|
|
|
|
|
Because a TableLayoutPanel is derived from a Panel, it has a BorderStyle - it's just that you can't see it in the properties windows (or Intellisense). You can alter it at run time, but not at design time:
tableLayoutPanel1.BorderStyle = BorderStyle.Fixed3D;
Intellisense will not find it when you get to the dot, but keep typing and it will be accepted, and will compile and run cleanly.
All those who believe in psycho kinesis, raise my hand.
My 's gonna unleash hell on your ass. tastic!
|
|
|
|
|
I wrote some code and have problem in line *. I get my modem names correctly but when I want to instantiate a Modem object I face an exception in line * which is: "This modem is invalid".
static void Main(string[] args)
{
TAPI tapi = new TAPI();
bool b = tapi.Initialize();
ArrayList list = tapi.AvailableModems();
* tapi.modem = new Modem(list[1].ToString(), tapi, new IntPtr());
Modem modem = tapi.modem;
modem.Call("6632");
}
list[1] is correct because I checked it and also I should say that my modem is connected to an internal dormitory phone line which I can dial other rooms, so my number in Call() function is just 4 digit long. I wanted to know that is that possible that because my modem is connected to an internal phone line I faced that exception? Excuse me for any mistakes because of my poor English.
modified on Tuesday, February 2, 2010 2:02 AM
|
|
|
|
|
I have this simple code running on my windows server just fine, but when I run it in mono after a couple days I start getting only OutOfMemory exceptions.
public static byte [] TryReceive (Socket sock, out int nLength)
{
nLength = 0;
try {
int size = sizeof(int);
byte [] data;
int recv = 0;
int offset = 0;
data = new byte [size];
while (size > 0) {
recv = sock.Receive(data, offset, size, SocketFlags.None);
if (recv == 0)
return null;
offset += recv;
size -= recv;
}
size = BitConverter.ToInt32(data, 0);
offset = 0;
data = new byte [size];
while (size > 0) {
recv = sock.Receive(data, offset, size, SocketFlags.None);
offset += recv;
size -= recv;
}
nLength = data.Length;
byte [] dataGraph = new byte [data.Length - 1];
Array.Copy(data, 1, dataGraph, 0, dataGraph.Length);
if (BitConverter.ToBoolean(data, 0))
dataGraph = DecompressBytes(dataGraph);
return dataGraph;
}
catch (OutOfMemoryException) { ObeServer.log.Log(1, "OutOfMemory when receiving packet."); return null; }
}
Could someone please see something that might be causing this?
TIA
|
|
|
|
|
In fact this may be an issue with the TCP window size, let me explain that.
Certainly the size that you try to decode is wrong, due to a framing issue.
If it's a TCP, you need to have some sync stuff, you cannot consider with TCP even if it's a connected protocol that the byte you will receive is always here. That's why you need a sync byte (eg. 0x80 for RTP protocol or HTTP string for HTTP....) prior the size.
The windows socket size is different from OSes (eg. Linux and Windows) and the TCP NO WAIT depends on the stack configuration.
So, I advise you to check if the : size = BitConverter.ToInt32(data, 0); is correct and not a very high value which may cause the memory leak.
My two cents
|
|
|
|
|
A typo in my previous mail is that RTP is a UDP protocol not a TCP
|
|
|
|
|
So what you're saying is that even though I make sure to read 4 bytes off the socket they may not be the correct four bytes so when I cast them it converts into a monstrous integer? The server manages flash clients and everytime someone does a postback or otherwise the flash reloads and then reconnects. I wonder if it has todo with old data sitting on the socket from the previous connection. But I do create a new socket everytime they connect, but maybe it has todo with mono's socket pool code. The Sync Byte, how would I go about about implementing something like that and what is it fixing exactly? Is it implemented something like this?
Socket.Send(0x80+Size+Data);
while(true)
{
if(Socket.Receive(0,1)==0x80)
{
size = BitConverter.ToInt32(Socket.Receive(0, sizeof(int)));
break;
}
}
I'm sorry for all the thinking out loud and questions, this error has caused me tons of headache.
Am I thinking in the right direction with that?
|
|
|
|
|
You got it.
The problem with TCP is you may have a text protocol (HTTP, ...) or binary (RDP - remote desktop...)
If your protocol is too weak you can resync, so you may have or not a control.
Send -->
<-- Ack Or Error
If you want to be sure that the message has been delivery, for instance the ftp protocol does this.
case "REST":
...
break;
default: //We Don't understand the Command
SendMsg("500 Command not understood\r\n",ref outBuffer);
break;
My advise, is read you socket buffer normaly, check at the beginning that you have a signature 0x80 (for instance), if not consume the buffer, and wait for another packet, or another option, search for the sync byte.
On heavy traffic, the tcp stack may overloaded, in this case you may have in your buffer.
First Read
0x80 xx xx xx xx 0x80
Second Read
xx xx xx xx 0x80 xx
Third Read
xx xx xx 0x80 xx xx
....
You can mark the start and the stop of your packet, start with a 0x80 and then get the size (which gives the size), you can break and split you data, and consume. Place your uncomplete packet in a waiting queue, and wait for the following one. When received, add it to the end, check that the size matches the new packet, if not drop it and resync.
A bit complex at the beginning, but I can insure that it works fine in all cases. Trust me I work in the telcom area, I know what is TCP over load... thanks to the Apple phone
|
|
|
|
|
Hi
I've C# Windows which has some message box to prompt some info. I'm trying to invoke this from DOS (batch file) at that time i just want to skip all the prompt message boxes. Is there anyways to do it from DOS?
Thanks
|
|
|
|
|
Would you mind providing more clarification?
Are you trying to invoke an existing application (.exe) from a DOS batch file. Or are you invoking a method within the program.
|
|
|
|
|
Im trying to access existing application from DOS. Exactly saying am trying to create virtual directory using the following commands
cd C:\WINDOWS\system32
IISVDir.vbs
IIsVDir /create "Default Web Site" App C:\Inetpub\wwwroot\App
IIsVDir /create "Default Web Site" AppService C:\Inetpub\wwwroot\AppService
IIsVDir /create "Default Web Site" ServiceRequest C:\Inetpub\wwwroot\ServiceRequest
But for every line it asks confirmation so Im just trying to automate it with some predefined parameters.
Thanks ....
|
|
|
|
|
If I understand correctly you're trying to close 'popups' that appear from another application, right?
In that case you'll need to import some windows dll's (winapi) (I think you'll need the user32.dll, but I'm not sure) that expose the Windows functions like FindWindows, GetDlgText, etc... With those functions you'll need to:
1: Find the correct window (probably need a loop that will redo this every x seconds)
2: if window is open (= encountered in step 1), press the button (Yes, No, OK, Cancel) I don't know the exact function for this, but it exists. avoid closing or killing the msgbox, instead try to let the msgbox handle itself by using one of the closing buttons.
You'll have to find the correct functions and signatures on MSDN, but there is a lot of info out there about this topic.
|
|
|
|
|
Hi,
I am having custome Link List object.
Which manages nodes and searching using while loop (node.next()).
I am new to Linq
Is Linq can be used with my Link List object to avoid loops?
Thanks Regards
Khaniya Sunil
|
|
|
|
|
If I understand your question correct - yes, you can use Linq to search a List<t> (using Linq to Objects). For an example, have a look at this.
Good luck
|
|
|
|
|
hi Calla
Thanks for your response
Actually I am talking about custom Liked List(data structure).
where nodes are connected via reference to each other
We are having reference of only first node.
Thanks
|
|
|
|
|
You can use linq only on those objects which can be treated as a collection of objects.
You can read your link list at a time and store it in a list or array
and then you can apply linq query to them.
|
|
|
|
|
|
is Global variable good or bad in c#.net? If i declare Global variables instant of singleton variables its good or bad for application??
Thanks
Raj
|
|
|
|
|
As a general practice, global variables are bad. This compromises the security of the application, as well as eliminating any chance of data-hiding through the use of objects and variable passing.
Now, this of course depends on the type of information and the use of the program. You may want to use a static global variable for things like links or connection information etc. This means that the variable cannot be changed at any point of from anywhere else in the program though. It will exist as a static reference value.
What are you trying to accomplish with the global variable?
|
|
|
|
|
Eric (eD) wrote: As a general practice, global variables are bad.
Myth. Global variables should generally be avoided when possible (and used as a last resort), but they're not "bad", and there are times when you simply must use one to accomplish some tasks. Besides that, global variables *technically* aren't even possible in .Net.
Eric (eD) wrote: You may want to use a static global variable for things like links or connection information etc. This means that the variable cannot be changed at any point of from anywhere else in the program though.
Not quite. Static members in an object exist for the lifetime of the application, and can be changed from anywhere (and by any other object) if they have the appropriate visibility. In fact, it's common practice to create a static class for just that purpose. In many ways, using static class members can be fraught with as much - if not more than - "global" variables, but like globals, they're pretty damn handy in a pinch, and you shouldn't hesitate to use them if the architecture demands it.
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
I'd say it is pretty meaningless to say this or that programming practice is inherently good or bad. The only proper answer is always "it depends".
That said, I'm not really sure what you mean by "global variable". C# does not have them. You seem to mean instance members of a singleton. From the language's point of view that's just like any other instance member, the singleton after all is a pattern you can implement with C#, but not a concept that the C# language itself "is aware" of.
In general, if you are using the object-oriented paradigm, it is considered bad practice not to encapsulate state. Therefore, you should expose the state through properties (or methods in a few cases). These may be read-only or read-write, as long as you perform validation to guarantee object state remains valid at all times.
What is your motivation for wanting to use a "global variable"? There may be many ways to accomplish what you seek, such as using static members (which is the closest thing to global variables you can find in C#), thread data, application state (in an asp.net context) or other mechanisms.
|
|
|
|
|
Hi,
I am using VS 2008. My Datagridview is having bounded columns. Datasource is using as DataSet with Binding source.
I wanted to show these as vertical view ( swaping columns to rows)
how can i do? please help me
Ramana
|
|
|
|
|
|
Hi. I want to download a file from one website. It is really simple do it like this:
WebClient wc = new WebClient();
wc.DownloadFile(@"http://aaa.uuu", @"D:\111.gig");
But when a file is attachment... in response we have header: "Content-Disposition: attachment; filename="file.gif"", I couldn`n download file.
I`v seached smth around this problem and sow like this:
string filepath = Server.MapPath("test.doc");
FileInfo file = new FileInfo(filepath);
if (file.Exists)
{
Response.ClearContent();
Response.AddHeader("Content-Disposition", "attachment; filename=" + file.Name);
Response.AddHeader("Content-Length", file.Length.ToString());
Response.ContentType = ReturnExtension(file.Extension.ToLower());
Response.TransmitFile(file.FullName);
Response.End();
}
The first problem is what i couldn`t use class Response, becouse i couldn`t use System.Web.UI.
Plz, explain me, I couldn`t use System.Web.UI becouse I programming in C# but not in ASP.NET?
And could anybody help me with downloading file, which is attachment?
|
|
|
|
|
hello_amigo wrote: I programming in C# but not in ASP.NET
ASP.NET is a technology, a framework; you can't "program" in it. ASP.NET uses C#, or other lesser languages (VB.NET )
I know the language. I've read a book. - _Madmatt
|
|
|
|
|