|
I have a publish subscribe system, that upon subscribing to it, sends update in form of an event... when I subscribe for tooo many items ... I end up generating lots and lots of events at the client end. Now how to handle such a situation...
Any Suggestion ...
|
|
|
|
|
Hi everyone,
I have a RTB, it's ScrollBars property is None. So if user types too many characters and characters rich the end of my RTB, he/she can't see some characters. How can I get the Maximum number of characters which my users can see?
Hope you understand
Thank you.
When you're alone in the Dark, Fear will protect you...
|
|
|
|
|
It will depend on the size of your RichTextBox and whether you are using a fixed length font or not, what was the reason for removing the scrollbar?
|
|
|
|
|
Thank you for your reply.
smyers wrote: the size of your RichTextBox
It's constant.
smyers wrote: whether you are using a fixed length font or not
Actually not.
smyers wrote: what was the reason for removing the scrollbar?
Actually I want to create a MSWord-like application, when user riches the end of a RTB, I'll create a new RTB and user can type his/her remaining characters in it.
If you (or anybody) have another idea, I'll be glad to hear it.
Thank you again
When you're alone in the Dark, Fear will protect you...
|
|
|
|
|
Why are you creating a new RTB, is it for a new page?
|
|
|
|
|
smyers wrote: is it for a new page?
Yes, definitely.
Creating a new page instead of scrolling down, it's what I want to do.
You said it depends on RTB and font size. If your RTB's Height was 100pxs (WordWrap is true) and font size was 8 and font-family was Tahoma (is font-family makes any difference?) how could you do that?
Thank you very much.
When you're alone in the Dark, Fear will protect you...
|
|
|
|
|
I don't think this is the best way to do it, you will only be able to use monospace fonts and then you would have to physically count how many characters would fit in the RTB before they reach the end.
|
|
|
|
|
hi
i want to append string to third last line in a text file.
appending string to last line is running successfully.
please help.
Thanks in advance
|
|
|
|
|
I think you have to read the whole file, append the string at required location and then write the whole data again.
*jaans
|
|
|
|
|
Hello All,
I'm developing an application. In this application i want to detect the printer status. status means online , offline , low paper, no paper , paperjam. Can any one give suggestion on this.It will be great helpful for me.
Thanks in advance.
Sekhar Reddy
modified on Wednesday, November 12, 2008 12:50 AM
|
|
|
|
|
|
Hi Simon,
By using that WMI code creator, i creted that code like this.
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Set colItems = objWMIService.ExecQuery( _
"SELECT * FROM Win32_Printer where name='HP Color LaserJet 1600'",,48)
For Each objItem in colItems
Wscript.Echo "-----------------------------------"
Wscript.Echo "Win32_Printer instance"
Wscript.Echo "-----------------------------------"
Wscript.Echo "Status: " & objItem.Status
Next
It is not working properly.It is showing the status as "Unknown" or "Ok".
But i want the code for displaying the status "no paper", "low paper" etc.
Regards,
Sekhar Reddy
|
|
|
|
|
Actually to get the printer status I'm using the following code.
This code is written in c#
using System.Management;
ConnectionOptions oConn = new ConnectionOptions();
System.Management.ManagementScope oMs = new System.Management.ManagementScope(@"\root\cimv2", oConn);
System.Management.ObjectQuery oQuery = new System.Management.ObjectQuery("select PrinterState from Win32_Printer where Name = \"HP Color LaserJet 1600\"");//
ManagementObjectSearcher oSearcher = new ManagementObjectSearcher(oMs, oQuery);
ManagementObjectCollection oReturnCollection = oSearcher.Get();
foreach (ManagementObject oReturn in oSearcher.Get())
{
//PrinterState returns a hex value but I use a string/int value
//
// state value
//------------------------------------------------
// Online 0
// Lid Open 4194432
// Out of paper 144
// Out of paper/Lid open 4194448
// Printing 1024
// Initializing 32768
// Manual Feed in Progress 160
// Offline 4096
string status1 = oReturn["PrinterState"].ToString();
int status = Convert.ToInt32(oReturn["PrinterState"]);
switch (status)
{
case 0:
label1.Text = "Online";
break;
case 1:
label1.Text = "Paused";
break;
case 4194432:
label1.Text = "Lid Open";
break;
case 144:
label1.Text = "Out of Paper";
break;
case 4194448:
label1.Text = "Out of Paper && Lid Open";
break;
case 1024:
label1.Text = "Printing";
break;
case 32768:
label1.Text = "Initializing";
break;
case 160:
label1.Text = "Manual Feed in Progress";
break;
case 1026:
label1.Text = "Document failed to print";
break;
case 1027:
label1.Text = "Printing paused";
break;
case 4096:
label1.Text = "Offline";
break;
default:
label1.Text = "unknown state";
break;
}
this.Refresh();
}
This code is working fine. But the problem is , if the printer is on , then it is returning value as '0'. Even i switch of the power to printer , then also it is returning 0. Here 0 means "online". I want to show the status as "off line", "no paper", "low paper". etc.
Regards,
Sekhar Reddy
|
|
|
|
|
Sorry, I've never used the Win32_Printer class myself, I just know it exists. Perhaps someone else knows the answer. Try starting a new thread with the new information you have tried.
Simon
|
|
|
|
|
hi..
I need to plot multiple sine wave using GDI+, but i can seet max 10 sine waves on the screen, i used verticle scroll bar to scrolldown when i scroll down it ll again re-draw the remaning sine waves..
how can i plot all 20 sine wave on to the bitmap at once and if i scroll vertically repainting of bitmap should not be there..
can anyone help me to do this..
any suggesstions or links to related topic also accepted...
pls do help me..
|
|
|
|
|
hello,
I have two datetimepicker controls named start date and end date.Then i choose a range through these datetimepicker controls.then i want to see all these dates in between the range along with one month before that range and one month after that range.I want to generate a calender which will show these dates.Plz send any sample.
thanks
aurosikha
|
|
|
|
|
why you are not using calendar control?
Cheers!!
Brij
|
|
|
|
|
You can set the max and the min date property for the month calendar control right after you have selected start and end date. This should solve your purpose.
Loading signature. Please wait...
|
|
|
|
|
hi,
Can I find any component that do this task "Pass Table Name Build Your Form " and give admin ability to change the type of control and hide any control as he want ?
|
|
|
|
|
hi all,
i have a array object in one of my method, i would like to know, should i dispose it when end the coding or not? It will automate throw into garbage colletor? Below is what i am done in my application,
private void DrawConnectedLine(Graphics g)
{
try
{
int[,] drawobjectlist = new int[totaltransporter,n];
:
:
:
drawobjectlist = null;
}
catch(Exception exp)
{
}
}
thanks in advance,
regards
cocoonwls
|
|
|
|
|
When you set an object to null, you're not actually disposing it, your just removing it's memory reference. While it's not a bad practice to set it's value to null once you're done with it, Visual Studio automatically removes the pointer for you when the method ends. It's good to see a developer that's concerned about memory management!
Cheers!
Richard
My code this week has no errors. But it's Monday morning and I haven't got out of bed.
|
|
|
|
|
Since your array contains integer, no need to dispose it. If you are using any types which has Dispose method, calling it after using is a good practice. Read[^] Scott's article on this subject.
|
|
|
|
|
cocoonwls wrote: should i dispose it when end the coding or not? It will automate throw into garbage colletor?
Disposal and garbage collection are two different things. Disposing an object doesn't cause it to be garbage collected.
You can't call the Dispose method on an array, as it doesn't have one. An array only uses managed resources, so there is no need for any disposal.
cocoonwls wrote: drawobjectlist = null;
Setting the reference to null serves no pupose at all in this case. The garbage collector already knows that the array is not used any more, and it can even have collected it before you remove the reference. You are just assigning a null reference to a variable that is not used any longer.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Just to reiterate what has already been said, an array itself doesn't support disposal but the objects contained in the array may, in which case you want to iterate over the items and call Dispose on each item. In this particular case, you have an array of int , which doesn't require disposal.
Setting the array to null in this scenario will have no effect. The JIT compiler (and by extension the GC) is smart enough to know when the object is no longer in use.
The thing to keep in mind is that the GC will only collect this array after it is no longer in use and when enough memory pressure exists to trigger a collection cycle. It won't necessarily be collected when the method goes out of scope.
Scott Dorman Microsoft® MVP - Visual C# | MCPD
President - Tampa Bay IASA
[ Blog][ Articles][ Forum Guidelines] Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai
|
|
|
|
|
Dear all,
Thanks your guys. Now i have clearly concept on disposal and GC.
|
|
|
|