|
Create a static class within the project's root namespace and create static variables in there.
Dave
|
|
|
|
|
You can make it public static inside the form, you could create a static class and put it in there, or you could use the singleton pattern. However, I would suggest that you first check that it actually needs to be stored like this rather then passed around as a parameter.
Hope this helps,
Chris
|
|
|
|
|
Or perhaps a public constant.
Public enumerations are also very good.
|
|
|
|
|
I use like the following...
public static class GlobalInfo
{
public struct Diary
{
public struct Status
{
public const string Active = "Active";
public const string Closed = "Closed";
...
The above works with enum too.
|
|
|
|
|
Hi ,
I have added 2 columns, 1 of type checkbox and 1 of type textbox
but i do not want anyone to edit the text in the cell but he can check any row, how can i achieve that.
|
|
|
|
|
just make the column readonly.
|
|
|
|
|
I am consuming a secure java webservice over https from an Excel Office add-in.
I am having problems with a method which both uploads and downloads a file. My binding looks like this:-
<binding name="uploadServiceHttpBinding" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="67108864" maxBufferPoolSize="524288" maxReceivedMessageSize="67108864"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="TransportWithMessageCredential">
' <transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
And the method signature like this:-
public byte[] uploadFromOffice(byte[] fileBytes, String fileName, Long folderId)
When I run the upload succeeds however c# does not like the response, I get the following error:-
There was a communication problem. The content type multipart/related; type="application/xop+xml";
start="<soap.xml@xfire.codehaus.org>"; start-info="text/xml"; boundary="----=_Part_8_23410216.1215684578307" of the response message
does not match the content type of the binding (text/xml; charset=utf-8).
I have been told that the web service is Mtom enabled. When I change my message encoding in my binding to be messageEncoding="Mtom" the server does not like the request and I get this error:-
'There was a communication problem. Could not find the attachment cid:http%3A%2F%2Ftempuri.org%2F1%2F633512846834593677'
Does anyone have any suggestions on where I am going wrong, or how to set about debugging this?
|
|
|
|
|
Hello everyone,
My operation is like this, I am using WinDbg to set a breakpoint to method foo. Here is what I did.
0:000> !bpmd TestDebug.exe TestDebug.Program.foo
Adding pending breakpoints...
0:000> lm
start end module name
00000000`00400000 00000000`00408000 TestDebug C (private pdb symbols) D:\Visual Studio 2008\Projects\TestDebug\TestDebug\bin\Debug\TestDebug.pdb
0:000> g
(1b0.5c4): CLR exception - code e0434f4d (first chance)
(1b0.5c4): CLR exception - code e0434f4d (!!! second chance !!!)
KERNEL32!RaiseException+0x5c:
00000000`77d4dd10 4881c4c8000000 add rsp,0C8h
But when pressing g, and the program stops, then I pressed k to display the current stack. I found there is no my code in the stack. The seems the stop execution is not because of breakpoint (because no break point hit information)? I am so confused. Any ideas?
namespace TestDebug
{
class Program
{
static void foo()
{
int a = 100;
throw new Exception ("Hello Exception Debug");
}
static void Main(string[] args)
{
foo();
}
}
}
thanks in advance,
George
|
|
|
|
|
Why don't you set breakpoints through VS IDE?
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my homepage Oracle Studios
Discounted or Free Software for Students:
DreamSpark - downloads.channel8.msdn.com
MSDN Academic Alliance - www.msdnaa.com
|
|
|
|
|
Thanks Thomas,
I am just trying new things. Any ideas?
regards,
George
|
|
|
|
|
Hi,
I have a project done in c# VS2003. And i need to change the layout, but i have a problem, i don't know how to solve it!
I have a form (the parent) with the FormBorderStyle property set to FormBorderStyle.None. When i try to open the MDI Child forms with the same property set to FormBorderStyle.None the behavior is different. The border and the title bar appear briefly (like a flash)and then the form is correctly displayed.
How i can solve this problem?
Thanks!
|
|
|
|
|
I'm using form with IsMdiContainer set to True. I then create and show form, but I did not set the form.MdiParent to the Mdi container form. How can I retrieve all forms which I previously created?
|
|
|
|
|
Hi...
When i click on IE's Title bar and move it. Then which event will be fired.
And how to handle this event in c#.
Kiran Banker
|
|
|
|
|
1) How to store "connection string" in global.asax file and web.config file using c#?
2) How to get that "connection string" from web.config file and global.asax file to My web application?
3)Where i have to call that connection string on My web application and how i call to that connection from My web application..?
CheeN
|
|
|
|
|
Hi
Iam using Masked Textbox for Time format 24 Hours and Minuts 60 Seconds 60 I need a Time Format Valdation.please some examples.
somasundaram
|
|
|
|
|
Hi,
I have a Socket Class which connects, accepts the multiple clients and receive data from each client. I'm using a thread to accept the connection. I have to pass the IpAddresses and status to the GUI for display. How do I pass the value from thread to GUI? How do I user SendMessage/PostMessage method? Can I use the Invoke method. Please explain.
Thanks in advance
|
|
|
|
|
Cross thread GUI updation is not allowed. You need to use the invoke method.
|
|
|
|
|
Can you show me a sample code how to use Invoke method ?
|
|
|
|
|
string newText = ...;
form.Invoke(new MethodInvoker(delegate {
textBox.Text = newText;
}));
|
|
|
|
|
The code should be put in the thread or in the form?
|
|
|
|
|
Susanmat wrote: The code should be put in the thread or in the form?
It should be in the method which updates GUI. See the following sample
void WorkerMethod() {
if(this.InvokeRequired)
this.Invoke(new MethodInvoker(UpdateGUI));
}
void UpdateGUI() {
}
|
|
|
|
|
You might want to take a look at BackgroundWorker object. An example might look like the following, depending on your needs.
_bw = new BackgroundWorker();
_bw.RunWorkerCompleted += new RunWorkerCompletedEventHandler(Worker_RunWorkerCompleted);
_bw.ProgressChanged += new ProgressChangedEventHandler(Worker_ProgressChanged);
_bw.DoWork += new DoWorkEventHandler(Worker_DoWork);
_bw.WorkerReportsProgress = true;
_bw.WorkerSupportsCancellation = true;
Look at
_bw.ReportProgress(..) method
|
|
|
|
|
The problem is My thread which updates the value is in a different class and I need to update the value in another from. The thread will accept clients and I need to update the status ( ture or false ) in the main form.So where should I call the delegate. I'm not able to get that. Please help
|
|
|
|
|
Hi,
My new project is to go through a list of tasks against each sql server 2005 machines. Each task has a different sql query which gets executed and the data is returned for each task.
I am thinking of having each task with the relevant sql inside an xml file.
i.e.
<tasks>
<task>
<name>get the version of sql server</name>
<sql>sql code here</sql>
</task>
<task>
<name>get domain name</name>
<sql>sql code here</sql>
</task>
<task>
...
</task>
</tasks>
Then a winform application goes through this list in the xml file and for each task it's sql gets executed against the master database.
1)
Is what I am doing correct?
2)
Can the .net front end pickup the sql as a string and execute it against the sql server 2005?
Thanks
|
|
|
|
|
arkiboys wrote: 1)
Is what I am doing correct?
Its one way of doing it.
arkiboys wrote: 2)
Can the .net front end pickup the sql as a string and execute it against the sql server 2005?
Yes, use the SQLCOMMAND object
Bob
Ashfield Consultants Ltd
|
|
|
|