|
Hi. Im writing a windows application in C# and it has to be able to send the contents of a textbox to the printer. I'm using a StringReader to do this.
My only problem right now is the textox does not send tabs to the printer. I use \t to format the data the way I like and it displays fine on screen but when it gets sent to the printer its like the \t is ignored and all the data is crunched together.
Any ideas?
Thanks
|
|
|
|
|
I am working with a dataset in which I need to access about 11 tables with lots of child/parent relations. I was going to do one large SQL statement but would using Relations.Add be better? Is one considered better than another?
|
|
|
|
|
I'm writing Browser Helper Object (IExplorer plug-in) in C#, Microsoft VS 2005, Framwork 2.0.
1. I implement interface IObjectWithSite and add event handler for events SHDocVw.DWebBrowserEvents2_Event.DocumentComplete and SHDocVw.DWebBrowserEvents2_Event.OnQuit in function SetSite :
[System.Runtime.InteropServices.ComImport, System.Runtime.InteropServices.Guid( "FC4801A3-2BA9-11CF-A229-00AA003D7352" ), System.Runtime.InteropServices.InterfaceType( System.Runtime.InteropServices.ComInterfaceType.InterfaceIsIUnknown )]
public interface IObjectWithSite
{
void SetSite( [System.Runtime.InteropServices.In, System.Runtime.InteropServices.MarshalAs( System.Runtime.InteropServices.UnmanagedType.IUnknown )] object pUnkSite );
void GetSite( [System.Runtime.InteropServices.In] ref System.Guid riid, [System.Runtime.InteropServices.Out] System.IntPtr ppvSite );
}
[System.Runtime.InteropServices.ComVisible( true ), System.Runtime.InteropServices.Guid( "C06B3B91-769A-42d5-8BCD-CF70F8589FBA" ), System.Runtime.InteropServices.ClassInterface( System.Runtime.InteropServices.ClassInterfaceType.None )]
public class DOMPeek : IObjectWithSite
{
void IObjectWithSite.SetSite( object pUnkSite )
{
if(m_IUnkSite != null)
{
System.Runtime.InteropServices.Marshal.ReleaseComObject( m_IUnkSite );
}
m_IUnkSite = pUnkSite;
try
{
SHDocVw.DWebBrowserEvents2_Event WebBrowserEvents = (SHDocVw.DWebBrowserEvents2_Event)m_IUnkSite;
WebBrowserEvents.DocumentComplete += new SHDocVw.DWebBrowserEvents2_DocumentCompleteEventHandler( OnDocumentComplete );
WebBrowserEvents.OnQuit += new SHDocVw.DWebBrowserEvents2_OnQuitEventHandler( OnQuit );
}
catch // cast or no such interface exception
{
}
return;
}
void IObjectWithSite.GetSite( ref System.Guid riid, System.IntPtr ppvSite )
{
}
2. Implement event handlers OnQuit and DocumentComplete
void OnQuit()
{
System.Windows.Forms.MessageBox.Show( "OnQuit" );
}
void OnDocumentComplete( object pDispatch, ref object VariantURL )
{
System.Windows.Forms.MessageBox.Show( "OnDocumentComplete : " + VariantURL );
}
3. I register the object DOMPeek as Browser Helper Object in windows register.
Then I run IExplorer and see the messageBox "OnDocumentComplete : about:blank". Then I close IE window and see the messageBox "OnQuite".
The problem consist in that I take this result only in MSWindosw2003sp1 (server) with MS VS2005 installed. In MSWindowsXPsp2 without any updates, without MS VS2005, but with all Framework installed I didn't see the messageBox "OnDocumentComplete : about:blank", but see the messageBox "OnQuit". What's problem??? What updates need for correct working in MSWindowsXPsp2???
Then I try to install all updates for MSWindowsXPsp2 from Microsoft site and again didn't see the messageBox "OnDocumentComplete : about:blank", but see the messageBox "OnQuit". Then I try to install MS VS2005 but didn't install all updates for MSWindowsXPsp2 and again didn't see the messageBox "OnDocumentComplete : about:blank", but see the messageBox "OnQuit". Finally I install all updates for MSWindowsXPsp2 from microsoft site and then MS VS2005 then I see the messageBox "OnDocumentComplete : about:blank" and "OnQuit". But if I install MS VS2005 and then all updates for MSWindowsXPsp2 then not woking (didn't see the messageBox "OnDocumentComplete : about:blank", but see the messageBox "OnQuit").
What's problem??? What specifically updates need for correct working in MSWindowsXPsp2???
|
|
|
|
|
i have 5 checkboxes check1,check2,check3,ckeck4,check5,a textbox txt1 in my Form
if (check3.checked == true)
txt1,text ="Good morning "
if(check3.checked && check1.checked || check2.checked || ckeck4.checked || check5.checked)
{
txt1.text="good afternoon"
}
if(!check3.checked && !check1.checked && !check2.checked && !ckeck4.checked && !check5.checked)//non are checked
{
txt.text="good evening"
}
my textbox must automatically display the values,how do i do it,which events do i use
regards paula
|
|
|
|
|
On each of the check boxes register to the CheckChanged event, and register this method -> the same method.
|
|
|
|
|
is there a possibility to convert an argb value to rgb? I have to conform with a file information format where i have to write only rgb values... thanks!
|
|
|
|
|
Can you not just drop the a?
|
|
|
|
|
how can i do it? because the C# Color is auto-ARGB ... thanks a lot...
|
|
|
|
|
The .NET Color struct provides these instance properties: A, R, G, and B. You can use the last three to get the values you need.
Josh
|
|
|
|
|
That depends on how you want to convert it. The alpha channel (A) contains transparency information.
If you don't use transparency you could just drop that information. If there is transparency information you should draw the image on a solid background so that you get an image without transparency.
An ARGB value is a 32 bit value. You can mask off the top 8 bits to get the 24 bit value for the RGB channels:
int rgb = argb & 0x00ffffff;
---
b { font-weight: normal; }
|
|
|
|
|
Hi.
How do I draw a graphic with C# on .net (like excel)?
My datas are in database. I will take them to dataset or an array.
Thanks.
|
|
|
|
|
Have you thought about using a DataGridView?
|
|
|
|
|
How can I find out the mode and compression format of tiff images ?
|
|
|
|
|
I have created a listview in my C# form and when i add an item through my code I change the background color of my cells/rows. However, when i scroll over them at runtime the color defaults back to white and then they stay white. I have different tab pages in my form. If I switch to a different tab page and then come back the colors will be back where they were until they are selected or scrolled over again. Is this simply a glitch in VS? I have no idea how to fix it. When I enter items into the listview I am using the following code.
ListViewItem li = new ListViewItem(le.TimeStamp.ToString());
//Allows us to use different fonts, backgroud colors, etc. for individual items within a row on the
//list view and for entire rows themselves
li.UseItemStyleForSubItems = false;
string mt = "";
//depending on the type of message that is being logged to the case tab a color indicator is chosen
//to be displayed in the "Indicator" column
switch(le.MessageType)
{
//display a green indicator bar and a message for "Informational"
case "Informational":
{
mt = "Informational";
li.SubItems.Add(mt);
li.SubItems.Add("");
li.SubItems.Add(le.Message);
li.SubItems[2].BackColor = Color.Green;
CaseLogListView.Items.Add(li);
break;
}
|
|
|
|
|
Hi,
I've written a program which stores user data for websites. I would like the user to be able to fill in forms automatically on a webpage based on the data in my program.
I see two possibilities, but don't know if either of the two would work.
1) Drag the relevant text from a textbox in the desktop app to the webform into the relevant field. I can't get the textbox to let me drag the text, though.
2) Automatically insert the text into the webform field which has the focus, whenever the user clicks on a button in the app. Wouldn't know how to approach this one...
Does anyone have any ideas?
Thanks.
|
|
|
|
|
i have dataset has been filled data
A dataview =dataset
and i RowFiltered the dataview and it has 10 records now i want to navigate between thes records
thsnks for helping me
MD_NADA
|
|
|
|
|
Hi
If there is not any button control on winform then forms key press event is fires But if we place button control on winform then focus directly goes to button and keypress event of the form does not get fired.What can be the reason. It can be easily replicated by just writing any code in keypress event of windows form there should not be any control on the form then its keypress will be fired, now just place a button control u will see form's key pressed is not getting fired.
It seems focus issue.Can anyone advice.
Atul Kumar
|
|
|
|
|
In Windows applications, if there is ANY control on a form that CAN receive the focus it does, and the form does not. You are correct, it is a focus issue, and it was designed that way.
HTH explain it anyway.
|
|
|
|
|
Set the Form's KeyPreview property to true, and it's KeyPress event will fire before the active control's KeyPress.
Josh
|
|
|
|
|
Thanx a LOT Josh It is working.
|
|
|
|
|
static class in C# can accept serialization attribute.
like
[Serializable]
static class MyStatic
{
static MyStatic()
{
}
}
compiler will not give error.
But my question is can i serialize static class.if so how i can do?
M.Sendilkumar
|
|
|
|
|
You can't serialize a class, only an instance. An instance of that class would be serializable, but that is quite useless, as you can't create an instance of the class.
I'm not sure if it's an oversight in the design that a static class can be serializable, or if it's intentional. It shouldn't cause any problem anyway.
---
b { font-weight: normal; }
|
|
|
|
|
Guffa wrote: I'm not sure if it's an oversight in the design that a static class can be serializable, or if it's intentional.
I don't think the AttributeUsage attribute provides a way to specify that an attribute can be applied only to non-static classes. That's probably why Serializable can be applied to any class.
Josh
|
|
|
|
|
hi to all,
i'm coding a routing that can read all the node of an xml file.
how can i know if a node has one or more child nodes
best regards and thanks in advance
fady
|
|
|
|
|
You could start by looking up System.Xml.XmlDocument .
Logifusion[^]
|
|
|
|