|
Thanks for the reply
The Word Library only contain version 12, witch is Office 2007. If I compile my application with that library and deploy it on a machine with Office 2003 I get this error:
System.IO.FileLoadException: Could not load file or assembly 'Microsoft.Office.Interop.Word, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
So I need a way to compile my application with Microsoft.Office.Interop.Word, Version=11.0.0.0
Thanx
Spaz
|
|
|
|
|
OK., when you add the reference into your project you will see some DLLs like
WORD
VBIDE
MICROSOFT.Office.Core
While you create setup you need add that library as part your setup and there you will see one DLL called MSO.DDL go to the properties and in Register Property select "vsdrfCOM" and build your setup.
This you no need to have any MS Office at your deployment PC. Please let me know if you havve any hiccup.
Thanks
Siva
|
|
|
|
|
Hello
Thanx for the help, im a bit in the blue here...
I did what you sad, importet the reference, created a new setup project. Changed the setting under register property to "vsdrfCOM". But when I try to run it on the deplyment PC I get this error:
"Unable to cast COM object of type 'Microsoft.Office.Interop.Word.ApplicationClass' to interface type 'Microsoft.Office.Interop.Word._Application'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{00020970-0000-0000-C000-000000000046}' failed due to the following error: Library not registered. (Exception from HRESULT: 0x8002801D (TYPE_E_LIBNOTREGISTERED))"
Any ide what could be wrong?
Thanx
Spaz
|
|
|
|
|
Hi All,
i m trying to take a printout using msExcel a printer is Dmp i want to set the page size width = 3 inches length= 10 inches i had code
<br />
ExlWorkSheet.PageSetup.Orientation = Excel.XlPageOrientation.xlPortrait;<br />
ExlWorkSheet.PageSetup.PaperSize = Excel.XlPaperSize.xlPaperEnvelope9;
where ExlWorkSheet is object of Excel Worksheet.
please suggest me something to produce the right output
Nikesh Kr. Yadav
CSS Infotech
Sec- 31
Gurgaon,
Haryana(India)
|
|
|
|
|
Is it possible to set a network adapter to promiscuous mode within a C# application?
Will this also work with WiFi?
Regards
dotman1
|
|
|
|
|
For specifying a file type we use Response.ContentType in a webapplication.
But it wont work on a windows application..What we shoul use instead??
|
|
|
|
|
Response is a object of ASP.Net, you cannot use that in window application. If you want to open some document use shell command
cheers
asithangae
|
|
|
|
|
Hello,
This will be a pretty long message so please bear with me, and thank you in advance for your help.
For the DataGridView , we needed to disable the ToolTip of the cells for all the columns EXCEPT for one column. And we wanted the ToolTip for that specific column to always show (and not hide after a certain amount of time).
My understanding is that the ToolTip of the DataGridView cannot be exposed, and therefore we had to do a work around. What we did was to create a class that extends the ToolTip and also a class that extends the DataGridView . The new tooltip class, named ManualToolTip , is then instantiated in our extended DataGridView class. (Note: there are other reasons for extending the DataGridView, but extending the ToolTip was done solely for this purpose.) Now, doing this created a lot of problems, I will not copy paste some code snippets and the error that we are getting.
ManualToolTip.cs
using System;<br />
using System.ComponentModel;<br />
using System.Drawing;<br />
using System.Windows.Forms;<br />
<br />
namespace UIControls<br />
{<br />
public class ManualControlToolTip : ToolTip<br />
{<br />
private bool _toolTipDisplayed = false;<br />
private Timer _toolTipTimer = new Timer();<br />
private Control _control;<br />
private Point _mousePoint = new Point();<br />
private string _toolTipText = string.Empty;<br />
private bool _hideOnMouseMove = true;<br />
private int _movePixelThreshold = 3;<br />
private bool _useTimer = true;<br />
<br />
public ManualControlToolTip()<br />
: base()<br />
{<br />
Init();<br />
}<br />
<br />
public ManualControlToolTip(IContainer container)<br />
: base(container)<br />
{<br />
Init();<br />
}<br />
<br />
private void Init()<br />
{<br />
this.StopTimer();<br />
<br />
_toolTipTimer.Interval = this.InitialDelay;<br />
_toolTipTimer.Tick += new EventHandler(ToolTipTimer_Pop);<br />
}<br />
<br />
public void StartTimers()<br />
{<br />
_toolTipTimer.Start();<br />
_useTimer = true;<br />
}<br />
<br />
public void StopTimers()<br />
{<br />
_toolTipTimer.Stop();<br />
_useTimer = false;<br />
}<br />
<br />
[DefaultValue(true)]<br />
public bool HideOnMouseMove<br />
{<br />
get { return _hideOnMouseMove; }<br />
set { _hideOnMouseMove = value; }<br />
}<br />
<br />
[DefaultValue(3)]<br />
public int MovePixelThreshold<br />
{<br />
get { return _movePixelThreshold; }<br />
set { _movePixelThreshold = value; }<br />
}<br />
<br />
[DefaultValue(null)]<br />
public Control Control<br />
{<br />
get { return _control; }<br />
set<br />
{<br />
if (_control != null)<br />
{<br />
if (_control is DataGridView)<br />
{<br />
DataGridView grid = (DataGridView)_control;<br />
<br />
grid.CellMouseEnter -= new DataGridViewCellEventHandler(grid_CellMouseEnter);<br />
grid.CellMouseLeave -= new DataGridViewCellEventHandler(grid_CellMouseLeave);<br />
}<br />
else<br />
{<br />
_control.MouseEnter -= new EventHandler(_control_MouseEnter);<br />
_control.MouseLeave -= new EventHandler(_control_MouseLeave);<br />
_control.MouseMove -= new MouseEventHandler(_control_MouseMove);<br />
}<br />
}<br />
<br />
_control = value;<br />
<br />
if (_control is DataGridView)<br />
{<br />
DataGridView grid = (DataGridView) _control;<br />
<br />
grid.CellMouseEnter += new DataGridViewCellEventHandler(grid_CellMouseEnter);<br />
grid.CellMouseLeave += new DataGridViewCellEventHandler(grid_CellMouseLeave);<br />
}<br />
else<br />
{<br />
_control.MouseEnter += new EventHandler(_control_MouseEnter);<br />
_control.MouseLeave += new EventHandler(_control_MouseLeave);<br />
_control.MouseMove += new MouseEventHandler(_control_MouseMove);<br />
}<br />
}<br />
}<br />
<br />
private void grid_CellMouseLeave(object sender, DataGridViewCellEventArgs e)<br />
{<br />
HideToolTip();<br />
_toolTipTimer.Stop();<br />
}<br />
<br />
private void grid_CellMouseEnter(object sender, DataGridViewCellEventArgs e)<br />
{<br />
DataGridView grid = sender as DataGridView;<br />
<br />
if (grid != null && e.RowIndex != -1)<br />
{<br />
DataGridViewCell cell = grid.Rows[e.RowIndex].Cells[e.ColumnIndex];<br />
ToolTipText = cell.ToolTipText;<br />
}<br />
_toolTipTimer.Start();<br />
}<br />
<br />
[DefaultValue("")]<br />
public string ToolTipText<br />
{<br />
get { return _toolTipText; }<br />
set { _toolTipText = value; }<br />
}<br />
<br />
private void _control_MouseMove(object sender, MouseEventArgs e)<br />
{<br />
HandleMouseMove(e.Location);<br />
}<br />
<br />
private void HandleMouseMove(Point location)<br />
{<br />
int pixelMovements = Math.Abs(_mousePoint.X - location.X) +<br />
Math.Abs(_mousePoint.Y - location.Y);<br />
if (pixelMovements >= MovePixelThreshold)<br />
{<br />
if (HideOnMouseMove &&<br />
_toolTipDisplayed &&<br />
!_mousePoint.Equals(location))<br />
{<br />
HideToolTip();<br />
}<br />
else if (_useTimer)<br />
{<br />
_toolTipTimer.Stop();<br />
_toolTipTimer.Start();<br />
}<br />
}<br />
}<br />
<br />
public bool IsDisplayed<br />
{<br />
get { return _toolTipDisplayed; }<br />
}<br />
<br />
private void _control_MouseLeave(object sender, EventArgs e)<br />
{<br />
HideToolTip();<br />
_toolTipTimer.Stop();<br />
}<br />
<br />
private void _control_MouseEnter(object sender, EventArgs e)<br />
{<br />
_toolTipTimer.Start();<br />
}<br />
<br />
private void ToolTipTimer_Pop(object sender, EventArgs e)<br />
{<br />
if (_toolTipDisplayed)<br />
{<br />
HideToolTip();<br />
}<br />
else<br />
{<br />
ShowToolTip();<br />
}<br />
}<br />
<br />
public void ShowToolTip()<br />
{<br />
if ( Control != null && !Control.Disposing )<br />
{<br />
this.Show(ToolTipText, Control,<br />
Control.PointToClient(new Point(Cursor.Position.X + Cursor.Current.Size.Width, Cursor.Position.Y)),<br />
Int32.MaxValue);<br />
_toolTipDisplayed = true;<br />
_mousePoint = Control.PointToClient(Cursor.Position);<br />
<br />
if (_useTimer)<br />
{<br />
_toolTipTimer.Stop();<br />
_toolTipTimer.Interval = this.AutoPopDelay;<br />
_toolTipTimer.Start();<br />
}<br />
}<br />
}<br />
<br />
public void HideToolTip()<br />
{<br />
if ( Control != null && !Control.Disposing )<br />
{<br />
this.Hide(Control);<br />
_toolTipDisplayed = false;<br />
<br />
if (_useTimer)<br />
{<br />
_toolTipTimer.Stop();<br />
_toolTipTimer.Interval = this.ReshowDelay;<br />
_toolTipTimer.Start();<br />
}<br />
}<br />
}<br />
}<br />
}
Error Message 1:
See the end of this message for details on invoking <br />
just-in-time (JIT) debugging instead of this dialog box.<br />
<br />
************** Exception Text **************<br />
System.ObjectDisposedException: Cannot access a disposed object.<br />
Object name: 'ViewSolutionForm'.<br />
at System.Windows.Forms.Control.CreateHandle()<br />
at System.Windows.Forms.Form.CreateHandle()<br />
at System.Windows.Forms.Control.get_Handle()<br />
at System.Windows.Forms.ToolTip.get_CreateParams()<br />
at System.Windows.Forms.ToolTip.CreateHandle()<br />
at System.Windows.Forms.ToolTip.Hide(IWin32Window win)<br />
at UiControls.ManualControlToolTip.HideToolTip()<br />
at UiControls.ManualControlToolTip.ToolTipTimer_Pop(Object sender, EventArgs e)<br />
at System.Windows.Forms.Timer.OnTick(EventArgs e)<br />
at System.Windows.Forms.Timer.TimerNativeWindow.WndProc(Message& m)<br />
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
Error Message 2:
See the end of this message for details on invoking <br />
just-in-time (JIT) debugging instead of this dialog box.<br />
<br />
************** Exception Text **************<br />
System.NullReferenceException: Object reference not set to an instance of an object.<br />
at UiControls.ManualControlToolTip.ShowToolTip()<br />
at System.Windows.Forms.Timer.OnTick(EventArgs e)<br />
at System.Windows.Forms.Timer.TimerNativeWindow.WndProc(Message& m)<br />
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
My guess is that I am not understanding the ToolTip correctly. It could be that it is creating and disposing differently than I thought. Could it be that a separate ToolTip instance is created per cell in the table? And does it Dispose when you do a Hide? Well, I'm really just guessing. I need help! Or, at the very least, direction.
Thanks in advance!
Rafferty
-- modified at 10:18 Wednesday 8th August, 2007
|
|
|
|
|
Help anyone?
|
|
|
|
|
i just started to use c#..
how can i do division using for loop or while loop?
i should,,
output dividend and divisor:
input answer:
input dividend:
input divisor:
quotient:
remainder:
im confused...sorry..
-- modified at 4:32 Wednesday 8th August, 2007
|
|
|
|
|
do You need this?
<br />
<br />
int[] Divide(int divisor, int dividend)<br />
{<br />
int remainder = dividend;<br />
int quotient = 0;<br />
<br />
while (remainder >= divisor)<br />
{<br />
remainder -= divisor;<br />
quotient++;<br />
}<br />
<br />
return new int[] { quotient, remainder };<br />
}<br />
<br />
|
|
|
|
|
how can i insert the numbers i want to be the dividend and divisor?
|
|
|
|
|
what do you mean insert the numbers?
you are writing base on Console or Windows ?
here is just a hint because I don't know what you are doing!!!
for Console
use Convert.ToInt32(Console.ReadLine());
and I suggest you to get a C# book!
|
|
|
|
|
console... okay... thanks for your time and effort...
|
|
|
|
|
thankyou Hessam Jalali...
|
|
|
|
|
you should ask your teacher if you have trouble with the homework
|
|
|
|
|
im studying online... sorry..
|
|
|
|
|
Hi,
I suggest you buy an introductory book on C# and work your way through it.
In my experience nothing can replace the first book on any language you want to learn.
Especially if it is the first programming language you are getting in touch with.
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
I'm trying to venture into making a class, but I'm still a bit dopey in the regard and still don't have everything perfectly understood. Here's what I have.
public void write(IntPtr address, byte[] value, UIntPtr bytes)<br />
{<br />
IntPtr bytesWrote;<br />
Process[] processList = Process.GetProcessesByName(hProcess);<br />
WriteProcessMemory(processList[0].Handle, address, value, bytes, out bytesWrote);<br />
}
But, when I actually make use of it, I still have to cast my stuff and basically write it like this. Whys this?
write((IntPtr)0x10036FA, new byte[] { 0xC6, 0x00, 0x8A }, (UIntPtr)3);
but I was hoping for something to the effect of
write(0x10036FA, (is there a cleaner way to do this?)new byte[] { 0xC6, 0x00, 0x8A }, 3);
|
|
|
|
|
choadvach wrote: 0x10036FA
and
choadvach wrote: 3
are ints. Ints != IntPtr's.
As the error message you'll get states, "Cannot implicitly convert type 'int' to 'System.IntPtr'. An explicit conversion exists (are you missing a cast?)".
Generally something is not given an implicit coversion if it's deemed unsafe. Forcing the use of an explicit cast ensures you know that the cast is happening.
if you don't want to have to cast then pass in an IntPtr ... one of the constructors on IntPtr takes an Int
IntPtr ip = new IntPtr(3);
|
|
|
|
|
Thanks, this helped a bunch and worked perfectly!
|
|
|
|
|
Good Morning,
I developed a web base project with different languages in c#. I used "Resources" to save different language variable. I am just wondering that can I use same technique in a desktop base application. I need it because I am going to develop a desktop base software in Visual Studio 2005. This software is a multi language software. User should have facility to choose desire language then whole software should change to that selected language. Any Suggesstion or comments?
Regards,
Abubakar
|
|
|
|
|
As I know You can do that ,
in VS2005 you can even declare a variable with name in other languages like Farsi or Arabic not just the value! and it works fine.
<br />
<br />
<br />
internal static string متغیرسلام {<br />
get {<br />
return ResourceManager.GetString("متغیرسلام", resourceCulture);<br />
}<br />
<br />
<br />
<br />
private void button4_Click(object sender, EventArgs e)<br />
{<br />
MessageBox.Show(Properties.Resources.متغیرسلام );<br />
}<br />
<br />
just as a tip the persian phrase means "Greetings Good People at CodeProject"
good luck
|
|
|
|
|
WinForm supports resources (and the support is better integrated in VS than what you find for ASP.NET - basically it's good enough for hobby translated programs). If you translate professionelly do NOT use VS to manage the translations, let the professionel translation tools do what they do best.
As a basic rule, the user has already selected the language (the language of the Windows userinterface), so while it might appear a great idea to allow the user to select language, there really is no need. As it's not that easily done either, I would not bother if I was you.
|
|
|
|
|
Hi everybody,
I was trying to load a dataset from the web service into the windows application.
It is giving the error like "The requested format is XML but it is in HTML format".
While debugging in from the dataset there are table and rows and then the Remote Format Property is also set to XML but i couldn't trace out the error.
Can you please give a solution to resolve the issue.
Best Regards,
M. J. Jaya Chitra
|
|
|
|