|
THANKS!, that worked perfectly
Mike - I love to program!
|
|
|
|
|
I'm trying to create a basic rich text editor using the .NET's new
RichTextBox control. However, it seems to me that the control is
unnecessarily difficult to work with - especially in comparison to the
RichTextBox ActiveX control I used to use in Visual Basic. For example, I've
still not discovered an effective way of making the selected text bold /
italic / underlined. etc.
With Visual Basic you could just set the control's SelBold / SelItalic /
SelUnderline properties to true but with .NET you from to do something along
the lines of:
rtbEditor.SelectionFont = new Font (rtbEditor.SelectionFont, FontStyle.Bold)
Which wouldn't be a problem except that the SelectionFont property is null
if you happen to have more than one font selected.
The only way around this that I can envisage is to looping through all
selected characters and individually change all of their font properties.
Surely there is some way of doing something as simple as changing the Bold
property without having to resort to ugly hacks like that?
|
|
|
|
|
Hi!
You can take a look at this article:
Getting WYSIWYG Print Results from a RTB[^]
Apart from printing you can see how to add new features to the derived RTB like SetSelectionBold() and the like.
Regards,
mav
|
|
|
|
|
Thanks. I'd have thought the RTB control would have this functionality 'out of the box' though - without it, the uses of the control seems rather limited in comparison to the VB control.
|
|
|
|
|
Hi everyone,
I want to display menu bar in the middle of the form.Can someone tell me which control can I use on my form a container control for main menu control?
Waiting for the reply.
Thanx
Tasneem
|
|
|
|
|
Hi guys, i need some help here.
I'm using a Socket object for sending UDP/TCP messages in a C# application. I need to set a certain TOS (type of service) before sending a message. Here's how i do it:
// variables declarations
Socket m_socket;
byte[] m_packet;
IPEndPoint m_remotePoint;
...
// set TOS
m_socket.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.TypeOfService, 5);
// check that the value has been set; n receives 5
int n = (int)m_socket.GetSocketOption(SocketOptionLevel.IP, SocketOptionName);
// send the packet
m_socet.SendTo(m_packet, m_remotePoint);
It seems that TOS has been set. However, when i catch my messages in a sniffer, TOS is invariably 0.
What am i doing wrong?
Thanks a bundle!
|
|
|
|
|
|
Hello, I'm writing (C#) class for pop3 message parsing and I got stuck with 8bit encoding of attachments (in general, 8bit encoding). Probably I missed something or I don't know much enough about mail format or MIME.
The question is: what should I do with string containing 8bit encoded data? How can I get proper bytes to write them to a file?
I tried to use Encoding.[ASCII | DEFAULT | UTF7 |UTF8] to get bytes, I tried to cast chars from string to byte, but I'm unable to write original bytes. Some non-standard characters (f.e. ś) are "garbled".
I'll be very, very grateful for any solution or clue, what I should do or what I'm doing wrong.
|
|
|
|
|
Hello,
I am having a serious issue and loosing the argument of using .NET Remoting in implementation of client/server architecture.
Can any one give me severral good reasons for using .NET remoting over writing custom implementation for client and server? The proposed solution is very straight forward, however I am wondering if there are any disadvantages to this approach we should be aware of.
My co-worker is proposing to implement listener on the server side that will catch encrypted traffic sent from the client. Then, parse sent message to find out what the request is and perform certain actions to server the client. After that, it would send info back to the client which is similarly listening on the certain port for incoming messages, then decrypting and parsing it.
Again, can someone explain why would one use .Net Remoting over described approach?
Thank you very much.
|
|
|
|
|
Hi,
Implementing .NET Remoting is very straight-forward as many of the things are already done for you.
If you like to go with TCP channels and binary formatters, its having the best performance.
You need to create an interface, business class and expose the class using the interface. You can easily manage the remoting settings using the configuration files.
If you plan to use HTTP channel and use IIS for the remoting server, its can be easily done as IIS handles all the security aspect the same way it does for any virtual directory. So, you get these benefits to use during remoting.
Let me know if you require more information.
Thanks
Achintya
|
|
|
|
|
I am very familiar with Remote Implementation and settings. We currently have to solutions one using .NET Remoting and another using sockets and custom implementation. We are trying to decide which one of the two we should base the new version of the product on.
I can't find to have good enough reasons to get them to go with Remoting solution. Some of the developers argue that's it's too much of the complication to the development process, use of the debuggers and dealing with registering assemblies. I am used to it, and don't consider it being problematic, unfortunately, others do.
So, i need a strong argument which will directly benefit the customer to go with .NET Remoting.
Thanks for your feedback.
|
|
|
|
|
Hey
i want to start my application with a form that is hidden... how on earth do u do that !! this.Hide() and this.Visible = false have not been working for me... not even in the Form.Load()...
thanx
|
|
|
|
|
You have to override the forms OnLoad procedure. You can set the forms Opacity to 0 in there. Then later, when you want to show the form, set the Opacity to 1.
' In VB.NET,
Protected Overrides Sub OnLoad(ByVal e As System.EventArgs)
MyBase.OnLoad(e)
' Make me disappear before I'm even shown...
Me.Opacity = 0
Me.Visible = False ' WON'T WORK!
End Sub
Now when you want to show the form, just set the Opacity back to 1.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I have to localize property display name i.e WebDisplayName of webpart .How to do it in ASP.NET 2.0?
|
|
|
|
|
Try this simple test:
Drop a NumericUpDown control (nud1) and a Button (b1) on a form. Make sure that nud1.DecimalPlaces is set to 0. In the Click handler of b1, display the value of nud1 by doing MessgeBox.Show(nud1.Value.ToString()). Run the application and type 4.513 in nud1 and click b1. The MessageBox will display 4.513 as the value, but nud1 will contain 5. Now click the up arrow of nud1 and then click b1. The MessageBox will now display 5.513 and nud1 will contain 6. If you type a new value, say 17, into nud1, the decimal places will go away. The same type of problem shows up if you set nud1.DecimalPlaces to 3 and type 7.12345 in nud1 (the extra decimal places hang around).
You can get around this by using the NumericUpDown.Text property (it always gives the correct value). However, studio does not show this property in the properties window and it does not appear when performing a ‘code complete’ when typing. The Text property is an overridden property of UpDownBase.
This appears to be a big problem since all of the msdn examples for NumericUpDown use the Value property to retrieve the value of a NumericUpDown. Does anyone have any comments/opinion?
Thanks …
wjr@itt
|
|
|
|
|
I discovered a problem with my workaround of using the Text property of the NumericUpDown to retrieve the correct value that is displayed by the control. In my simple example that I posted, accessing .Text worked fine. In my real, more complex app, accessing .Text in the button click handler caused the NumericUpDown to continue to display the wrong value (wrong number of decimal places) and the value returned by .Text was incorrect too. My workaround for this was to create a Validated handler for the NumericUpDown that did nothing more than assign the Value attribute to a variable and do nothing else with it. As long as .Value is accessed before anything else accesses .Text, things seem to be OK.
wjr@itt
|
|
|
|
|
Hello everyone,
I am currently using an ActiveX(COM) object in a .NET application. The image list for the COM control requires a stdOle picture, however, converting a .NET bitmap image to a stdOle picture is proving to be a bit of a hassle. Can anyone provide any info as to how I can convert the .NET image over to an stdOle stdPicture object so I can insert it into the COM image list? Any help would be appreciated.
Jay
|
|
|
|
|
Hello,
I have a PC with 2GB RAM, Windows XP and .NET 1.1 framework. My .NET application has huge memory requirements.
It crashes (ignoring my try/catch) because of an "unhandled out of memory exception", when it uses approx. 2GB RAM of pure RAM memory. (says the Windows Taks Manager, Performance, Physical Memory).
As I did set Windows XP (Control Panel - System - Advanced - Advanced - Virtual Memory - 2047 MB) to use 2extra GBRAM of virtual memory on my hard disk, it looks like .NET does not follow Windows, and refuses to use the extra virtual memory.
(1) Is there some kind of default (Windows XP or .NET) that I should know of, that will allow my application to use more memory than the physical 2GB RAM ?
(2) Is there any way to programmatically tell .NET that I will use virtual memory, instead of physical memory?
--Max
|
|
|
|
|
Max,
There should be no practical difference between virtual and real memory usage. What you are probably seeing is that even though there is a 4GB programming address space in XP, only 2GB is ever available to any application - the other 2GB is for the o/s.
You can change this with a startup option (I think it is /3GB ) which will increase the address space available to non-o/s programs to 3GB and reduce the o/s address space accordingly to 1GB. You'll need to look this up on Google/Microsoft etc for the exact syntax and further info.
Having said that, I would be attempting to use much less memory by storing data on disk in a database etc. Maybe your application must use memory, maybe not? It's worth considering anyway.
...Steve
|
|
|
|
|
Steve,
I used the /3GB startup option to launch Windows XP, but the "Out of Memory" exception fires exactly at the same time, i.e. when the program uses 2GB RAM Physical Memory (as told by Windows Task Manager / Performance / Physical Memory).
Is there anything else I have to do to get more than 2GB RAM of data under .NET ?
Max
|
|
|
|
|
Max,
I found a hit via Google on this problem...
Google is my friend
Basically you may be hitting a threshold limit for the ArrayList structure so even if you give it more memory there is no guarantee that it will use it all.
I strongly suggest that you look at virtualizing this data because even if you do somehow happen to get it running with 3GB memory, you may find that just one small change to the input will push the limits again.
Another approach may be to limit the size of each list entry by compressing each entry so that the ArrayListitself uses less memory.
...Steve
|
|
|
|
|
Steve,
Do you think that even if I get a Windows 64 machine with 16GBRAM or more, I will have access only to 2GB RAM data for each .NET object(ArrayList, Hashtable, etc.) ?
What about pure arrays: are they limited too to the int32 limitation?
Will .NET 2.0 fix this ?
Now for my problem: actually I did not realize how expensive using ArrayList is...
Each of the 15 million+ State are very small; probably 90% have less than 2 outgoing transitions.
I replaced the embedded ArrayList {char,int,char,int...} with two synch pure arrays char[] and int[], and now the whole thing gets stored in approx. 600 MB, which is fine (for now).
Thanks
Max
|
|
|
|
|
There's nothing "tunable" or configurable as far as the .NET memory manager is concerned.
Also, running the system out of handles can also cause the same problem. If you'r not freeing an unmanaged resource or not Disposing of some types of objects properly, you'll run into the same problem.
What are you using that's taking up all this memory?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I have a Hungarian dictionary (several dozen millions of word forms) that I need to store into a Search tree.
The search tree is basically an ArrayList of states; each state has the following fields:
public class DState
{
ArrayList CharsToDests;
int infonb;
int canonical;
(... and then the methods)
}
in which CharsToDests contains alternatively characters, and their corresponding outgoing state index, e.g.:
('a',23,'b',3456,'c',1200023,'d',57)
For some reason I don't understand, my ANTS profiler says each state consumes 20 bytes (I would have thought 4x3 = 12).
BTW, do you know how much memory such an ArrayList takes? would it be better to use two synchronized type-consistent ArrayList, e.g.:
ArrayList Characters;
ArrayList OutgoingStateNb;
or something else (I cannot use an array because these lists grow: I just need a list of chars and a list of int).
Anyways, after having stored 5 million words,
that gives me approx. 50 million states, with the connections in the Arraylist => I get approx. 2GBRAM and then the Out of Memory exception (that I cannot catch).
--Max
|
|
|
|
|
Sounds like you need to use a database rather than in-storage arrays.
...Steve
|
|
|
|