|
Hi!
You should be able to assign a culture by using the Thread.CurrentCulture property.
For example:
Thread.CurrentThread.CurrentCulture = new CultureInfo("de-DE"); Regards,
mav
|
|
|
|
|
thank you very much but which property of the datetimepicker can work with system.globolization?
|
|
|
|
|
You don't have to set the culture for every control separately.
You set it for a thread and each control running in this thread will/should use this cultureinfo.
mav
|
|
|
|
|
Is there a way of blocking Pop-ups using JavaScript in the axBrowser Com. ?
Is it possible to insert the code, before the page is shown?
Thanks
|
|
|
|
|
You might want to ask in a differnt forum, this one is for C# only.
Regards,
mav
|
|
|
|
|
I believe the system.management.instrumentation namespace provides classes to instrument an application. For example, if an application is stopped, an event will occur to get it started....
The problem is how to i determine the idle or unstable state of an application?
Welcome any advice
|
|
|
|
|
G_Zola wrote:
The problem is how to i determine the idle or unstable state of an application?
Hmm. Do have a separate watchdog application or service? I guess you want to monitor several things--has the application completely crashed (disappeared from the process list), has it gone into some infinite loop where it's no longer handling UI events (maybe your app can respond to a ping from the watchdog app and fails to respond), is it responsive but consuming a huge amount of CPU time, etc.
Just some ideas.
Marc
MyXaml
Advanced Unit Testing
YAPO
|
|
|
|
|
I wonder if there is a built in attribute in system.management which can access the status of the application. So far i have looked into the win32_Process namespace in root/cimv2 in WMI which may have only started or stopped values for the status attribute. Or i will need an explicit timer to poll the application?
|
|
|
|
|
Hi everyone,
I am trying to learn how to use dynamic controls with/by calling a class library (ButtonTest.cs) that is on a separte *.cs, that contains the properties that will set them from my main form (frmMain.cs). I am using windows forms, C#. The two codes for the two forms are as follows:
>>frmMain.cs<< Calling form
using System;
using System.Drawing;
using System.Collections;
using System.Component.Model;
using System.Windows.Forms;
using System.Data;
namespace Test
{
public frmMain()
{
InitializeComponent( );
ButtonProperties myTest = new ButtonProperties();
myTest.AddControl(new Button( ), new Point(5,5), new Size(75,75), "ButtonName", 0, "");
}
}
>>ButtonTest.cs<<
using System;
namespace Test
{
class ButtonProperties
{
public void AddControl(Control aControl, Point Location, Size Size, String strText, int TabIndex, string strName);
{
aControl.Location = Location;
aControl..Size = Size;
aControl.Text = strText;
aControl.TabIndex = TabIndex;
aControl.Name = strName;
this.Controls.Add(aControl);
}
}
}
Now the problem is that the "this.Controls.Add(aContol);" does not get returned and the button is not displayed. The error is as follows: "Test.ButtonProperties" does not contain a definition for Controls. Hmmm
Any and all help is truly appreciated.
MikeY
I can't be this stupid
|
|
|
|
|
Try adding the following to ButtonTest.cs:
using System.Windows.Forms;
|
|
|
|
|
Hi!
Trust the compiler, it's right.
Your class Test.ButtonProperties only has a single method and no attributes/properties.
You're calling "this.Controls.Add(aControl)", but your "this" (ButtonProperties instance) doesn't have a Controls property.
Perhaps you want to add it or derive ButtonProperties from a base class that has a Controls property.
Regards,
mav
|
|
|
|
|
Can this be done with both a textbox and richtextbox?
If you could please give me an example code.
Thanks
|
|
|
|
|
From what I've read it's not really possible to calculate the exact size of a string so that you can resize the textbox/richtextbox.
You can use Graphics.MeasureString() , but the results often are inaccurate. If you want to resize a RichTextBox I think you'd have to calculate the size of every substring that has a different font and then calculate the total size => immense effort to do it generically.
Regards,
mav
|
|
|
|
|
I have a windows form with a series of questions and multiple choice answers. The questions vary in size of text content. What is the best way to display text on a windows form if you have text content that varies in size? Can you draw it on screen instead of using a textbox or richtextbox? I've tried using a label but that doesn't work either.
The layout is like this:
Question:
...............................................
...............................................
...............................................
Choices:
...............................................
...............................................
...............................................
Answer & Explanation:
...............................................
...............................................
...............................................
Of course the form is scrollable in case the content gets too large.
Is there an easier way to do this?
|
|
|
|
|
Hi,
I want to make some changes to the row, -just before it is inserted..
Why is the following change not committed in the DB ???
-In debugger I can see the changes is OK!!, but in the DB the column is still Null.
* I fill some data into a dataTable.
* Using dataAdapter.Update(myTable);
protected static void RowUpdating(object sender, System.Data.SqlClient.SqlRowUpdatingEventArgs args)
{
if(args.StatementType == StatementType.Insert)
{
args.Row["CreatedBy"] = "Me";
}
}
|
|
|
|
|
Besinci wrote:
I want to make some changes to the row, -just before it is inserted..
Most likely because you are confusing the system--it's wanting to do an update, but by making an assignment to a field in the row, you're changing, or trying to change state, to an "Update".
Try using the RowUpdated instead. Although, this will result in a second write to the DB.
Which begs the question, why aren't you setting the field value when you create the data row to be inserted to begin with?
Marc
MyXaml
Advanced Unit Testing
YAPO
|
|
|
|
|
Marc,
My previus sample was just to ilustrate the issue..
I allso tried updated. without success.
The issue is to catch diferent StatementTypes and do something to the row depending on the StatementType..
thx, Besinci
|
|
|
|
|
I have a Deployment Project being created in Visual Studio .NET 2003 to deploy a C# application.
I need to add some registry entries. However, I need to ask the user a question about what to put in the registry, so I show a custom dialog and assign the value of the edit box to a property "PROP1".
Now, in my registry value, I tried putting [PROP1] which does not work. This works if the registry entry is a string value. However, my entry is a DWORD value, so it doesn't like it.
How can I get the contents of PROP1 into a DWORD registry entry?
Thanks,
...Matt
|
|
|
|
|
Hey!
If I use a Stream (say MemoryStream), and writes data to this stream with a StreamWriter.
Then if I read data from the same stream at the same time, what happens to the read data?
If I have understood this right then no data is removed from the stream even if it has been read? I have to cal flush to remove all the data.
Is this right?
Is a regular stream from TCP (Network) or File stream working this way? If, how does they handle the readdata?
If I flush after I have read, then the writer could have written some new data that I haven’t readied yet.
Best Regards
SnowJim
|
|
|
|
|
No. A MemoryStream works prety much likle a Text file, but in memory. The data is not removed when read. It just moves the current position pointer to the next character to be read/written.
There is a buffered area in a Stream operation that temporarily holds data being written to the Stream. This data typically isn't written directly to the Stream immediately, kind of like a cache. In order to make sure that the changes (data written) to the stream are finally commited to the stream, you call the .Flush() method.
Now, a Stream only has ONE position pointer. If you write a bunch of data to the stream, you have to position the pointer (seek) to the beginning of the stream is you waht to read all that data. Now, if you don't reposition the pointer back to the end of the data, your next write will overwrite data that you have written, but not read yet.
I think what your doing can be done with methods that are more suited to the task, but I don't remember you posting a specific description of why your going through this trouble.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Thanks!
The requirement on ower application is that we have to hand out a stream to the rest of the program.
This means that we have to write to that string and at the same time the other part of the program will have to be able to read from the stream using streamreader.
If we writes 1024 bytes to the stream every time(vary fast) then the other part of the program will probably not manage to keep up with the writer. There will probley be a small buffert all the time.
there by we cant clear the stream in any way.
Its strange that a stream really works like this? It should discard every byte it is reading.
I have seen that there is something cald peak (streamreader), that looks at the next byte with out discarding, this most mean that it will discard when reading from this stream?
What kind of stream is this? Can it really discard when reading?
I have tried to make my own stream, by using an Array List (with FIFO), this works, but the performance is to bad. I am placing one byte at one element, and when it’s readed on position 0 i remove it.
Will i have to do my own stream? And what buffert should I use? If I use a fixed byte array the buffert may run out before the reader have readed there data.
any proposition on my problem?
Best Regards
SnowJim
|
|
|
|
|
Streams do not discard the data as it is read, in general (although as Dave points out, the cursor must be manually positioned to move "backwards" in a stream).
StreamReaders are not streams (they provide utility methods to read streams), and the Peek method of StreamReader looks for the next byte in the stream without moving the cursor forward - that's all.
Is the requirement for your application actually to use a stream, or is it simply to provide some structure where values can be read/written, and where reading equates to removing the read value from the structure? What you seem to be describing is a Queue (not a stream type). The Queue class allows FIFO stacking of objects, which looks like what you want. Dequeued objects are physically removed from the list. Internally, it's a circular array.
The Queue class also provides a synchronized version for thread safety, if that's of any concern.
Alternately, you could develop your own Stream class, and make it do whatever you want.
Hope this helps.
The most exciting phrase to hear in science, the one that heralds the most discoveries, is not 'Eureka!' ('I found it!') but 'That's funny...’
|
|
|
|
|
Yes i understand that Streamwriters is not stream but tools to use on streams.
If the data is not discarded in an stream, then the data will eventualy become to big to store in memory. How does streams handle this?
If i use for example a stream with an TCP connection, and writes/reads on this stream, it will never be to big to fit in to the memory what i can se? and i am never using any flush, remove or souch.
Yes i have to provied a Stream from my software, streamreaders will be used on this streams later on. But Queue sounds good, I will probley have use of that in other softwares =)
Best Regards
SnowJim
|
|
|
|
|
As I understand it, a NetworkStream really just wraps a Socket. When Read (or BeginRead ) is called on the stream, it actually executes a Receive (or BeginReceive ) on the Socket . The NetworkStream itself does not appear to have an intrinsic buffer (byte[] ) the way a FileStream does.
NetworkStream actually does its work with unsafe code calls on a Socket below the surface.
If you need to periodically clear the stream, you could do so by just clearing the previously read portion of the stream or something, perhaps by reading the as-yet-unread portion of the buffer into memory, then creating a new stream with only that data (or as suggested before, implement your own stream for doing it), but either way, it may be important to synchronize your stream writing code and possibly your reading code when such an even occurs - you could lock the stream, clear the read portion, raise an event that it's been truncated, and unlock it.
Hope this helps.
The most exciting phrase to hear in science, the one that heralds the most discoveries, is not 'Eureka!' ('I found it!') but 'That's funny...’
|
|
|
|
|
Yes i have tryed to build my own stream there i use an ArrayList. Every Element is storing one byte, and this is not a good ide, ArrayList is to slow.
Then i thougt if i just use e memoryStream in side my stream, but then i have to synchronize as you say so i delet some readed date and during this deletion i will have to lock the memoryStream.
But if i have under stod it right i cant just delet some bytes in a memory stream, insted a vill have to use flush or somthing like that to remove the stream, and in this case all data will disipare.
Best Regards
SnowJim
|
|
|
|
|