|
An Image or something? do you have and example?
|
|
|
|
|
There is an Image class in ASP.NET, I presume that WinForms has a similar class. So look it up in the MSDN, and check out how to create one dynamically.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
Hello,
I want to create a setup program to deploy my application, but I'm a little confused on what I need to install on the user's computer in order for my application to work. I have implemented the boot strap sample from Microsoft's website in order to install the .Net framework, but I don't know for sure what to do to make sure that my application will be able to read data from an Access database.
At first I thought that I could just use a MDAC merge module in my .msi project, but then I read that MDAC doesn't include Microsoft Jet, which is what I am using to access the database. So, should I use a JET merge module in my project instead? Or will one of the pre-existing merge modules that ship with .Net work? I saw a database_access.msm and a database_access_enu.msm already included with .Net. Would one of these merge modules do what I need?
I'll take any suggestions. Thanks!
Blake
|
|
|
|
|
Those assemblies are for the Crystal Reports .NET runtime.
You can make your own merge module that just runs the installation (there's documentation included with the Jet download that details the setup switches) as a custom action, but VS.NET's MSI project designer doesn't give you very much flexibility.
I did create one for Jet 3.5 a while back which is available on InstallSite at http://www.installsite.org/pages/en/msi/msm.htm[^]. The page also states that InstallShield created a Jet 4.0 MSM and that you can download it from their web site.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Thanks for the reply. I'm still a little confused though. Here's a little more information.
My program needs to be able to open an access database and read data from it. The connection string that I am using for the dataconnection is "@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=EngSpanGlossary.mdb". I don't really understand how everything works, but I assume that this means I need the Microsoft Jet OLEDB 4.0 to be installed on the computer for my program to work.
So, will downloading the merge module from installshield and adding it to my setup project be sufficient for my application to run on other computers? Do I need the MDAC at all?
Thanks so much for your help.
Blake
|
|
|
|
|
Yes, .NET requires MDAC 2.6 or higher for ADO.NET (2.7 recommended). What you're using is the OLE DB driver for Jet databases, so OLE DB (part of ADO) is still required.
Just include the Jet MSM and the MDAC MSM (mdac27refresh is good) in the setup project and you're good to go. It will prompt for a redirection target, so just specify the [SystemFolder] (\windows\system32).
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Hi everyone,
I have a question regarding use of Excel 2000 through C#. I have an ASP.NET page that has a datagrid control. What I would like to do is use Excel on the server side (no client interface). I would basically like to use the Excel object for printing and adding some custom headers and footers. However, I have never used any MS office product on the server side. Can someone please tell me where to start researching about this? I tried MSDN and some links I found. I could not get any comprehensive information though. Most of them deal with using Excel on the client side.
Thanks,
Pankaj
Without struggle, there is no progress
|
|
|
|
|
The Excel COM class is the same on client and server side:
//import Excel namespace
using Excel;
//...
//create invisible Excel instance
Excel.Application excel = new Excel.ApplicationClass();
//open workbook
Excel.Workbook workbook = excel.Workbooks.Open(name, Missing.Value,..., Excel.XlCorruptLoad.xlNormalLoad);
//find sheet
Excel.Sheets worksheets = workbook.Worksheets;
Excel.Worksheet sheet1 = (Excel.Worksheet)worksheets.get_Item(1);
//do something
//...
excel.Quit();
|
|
|
|
|
Hi,
Thanks for the reply I will give this a shot.
Pankaj
Without struggle, there is no progress
|
|
|
|
|
Hi again,
Thanks for the reply. I was able to get it to work.
I have one more small question. Is it possible to pass a datagrid to an excel object to render?
Thanks,
Pankaj
Without struggle, there is no progress
|
|
|
|
|
Hi,
I have a situation where I need a focus event that is raised when a change in focus takes place on a user control.
Sounds simple, but this event needs to provide a reference to the control which is losing/lost focus and the control which is gaining focus. Does any one know if there is any easy way to achieve this using the events provided in the framework? I am trying to do this whilst avoiding deriving a custom control class for each of the controls thata ppear on my user control.
On a similar note, does anyone know if its possible for a button control to be overriden to prevent it from receiving focus (even temporarily)?
Thanks in advance
Rich
|
|
|
|
|
As with most control events in Windows Forms, the sender parameter is the control that raised the event:
public class MyControl : UserControl
{
public MyControl()
{
InitializeComponents();
foreach (Control c in this.Controls)
c.GotFocus += new EventHandler(this.Control_GotFocus);
}
private void Control_GotFocus(object sender, EventArgs e)
{
Control c = sender as Control;
DoSomething(c);
}
}
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
I'm using the IE web browser control. Do printing by executing the print command. I need to be able to get and set the page settings like margins, orientation, and header/footers. How do I access this?
|
|
|
|
|
You could try passing OLECMDEXECOPT_PROMPTUSER as the nCmdExecOpt parameter to IOleCommandTarget::Exec , or the cmdexecopt parameter to IWebBrowser2::ExecWB . As far as passing values to the *pvaIn in IWebBrowser2::ExecWB , see the documentation for the IDM_PRINT command. The pvaIn argument is discussed there.
Note, too, that while I'm using C++ conventions above, the same is true in C# when you define either the IOleCommandTarget or IWebBrowser2 interface (or reference them from the Microsoft.mshtml.dll assembly) and cast them from your WebBrowser control.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Well I looked and the pvaIn doesn't look too promising:
****
VARIANT of type VT_BSTR, VT_I2, or VT_ARRAY.
If pvaIn is a VARIANT of type VT_BSTR, pvaIn specifies the path to a custom print template.
If pvaIn is a VARIANT of type VT_I2, pvaIn can be set with the flags PRINT_DONTBOTHERUSER(0x01) and PRINT_WAITFORCOMPLETION(0x02) defined in mshtmhst.h. If 0 is specified, then the default behavior (show print dialog and do not wait for completion) occurs unless otherwise defined by the nCmdExecOpt parameter.
If pvaIn is a VARIANT of type VT_ARRAY, pvaIn specifies a SAFEARRAY containing (in the following order) a header BSTR, a footer BSTR, the address of an IStream pointer for a Microsoft® Outlook® Express header document, an alternate URL BSTR used for MSHTML in Outlook Express, and a DWORD containing flags.
Can be set to NULL to use the Microsoft Internet Explorer default print template.
****
It doesn't look like you can access the page margins, etc. from here. I was hoping maybe there was another object that you could get to. Looking through the sutff it doesn't look too flexible to me. There is something with printing templates in there, but in my case i can't you printing templates I need the application to specify the settings at runtime. (The settings have to be serialized to a db.)
|
|
|
|
|
Besides prompting the user (the first option I mentioned previously), there's not really an easy way to do this apparently. If nothing else, you could use a print template (perhaps extract it to a temporary location, like the user's TEMP directory, and pass the string). We do something similar in our application. Just use in-line styles to control the margins, header, and footer.
You could, however, temporarily modify the registry since these values are in the registry. You should be mindful to put the previous values back, however. See the registry key HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\PageSetup.
You could also try asking in the microsoft.public.inetexplorer.ie4.printing newsgroup. Scan the headers first as there might already be a solution.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
I guess you are right. I've been searching and print templates are about the only thing that I can do.
You mensioned inline styles. What code would I include in an HTML document to specify what margins to use...
Thanks for the registry tip - I also needed that one. LOL. Its like you read my mind.
|
|
|
|
|
You can either link one or more stylesheets (in the case of print preview templates, this is often a hastle), or you can use an inline <style> element (in the <head> , or in style attributes that almost all elements share:
<html>
<head>
<title>My Page</title>
<style>
body { margin: .5in; font-family: verdana,sans serif; }
p { font-size: 10pt; }
</style>
</head>
<body>
<p>Regular sentance with the 10pt font size from above.</p>
<p style="font-size: 8pt;">Smaller example sentance with inline style.</p>
</body>
<html> See Cascading Style Sheets[^] in the MSDN Library for more details.
Of course, using the inline styles with elements won't make much sense besides your header and footer, but you can use the <style> element to control the body's margins.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
I already knew about how to do it that way. See - IE adds those margins relative to the page setup margins. I was wondering if you can tell it what margins to use - absolute not relative.
I'll just do the registry hack. Thanks
|
|
|
|
|
Hi,
I am new to C# and trying to create an extended Class Library that extends Hashtable.
I have created a new class like this:
'public class SerializeableHashtable: System.Collections.Hashtable'
In a method called Load i load a Hashtable object from file and try to set it to SerializeableHashtable like this:
public System.Collections.Hashtable LoadHashtableForSample()
{
System.Collections.Hashtable table = new System.Collections.Hashtable();
return table;
}
public void Load()
{
this = LoadHashtableForSample(); // fails because this is readonly
base = LoadHashtableForSample(); // fails because it is not the right context for base ?!?
}
Both of the things i try in Load fails. So the big question is: How can i assign the Hashtable object to SerializeableHashtable? (In C++ it works using the this pointer ...)
Thanks a lot in advance
Thomas
|
|
|
|
|
Thomas Gondorf wrote:
Both of the things i try in Load fails. So the big question is: How can i assign the Hashtable object to SerializeableHashtable? (In C++ it works using the this pointer ...)
You can't. SerializableHashtable is a child of Hashtable. You cannot assign a parent object to a reference pointing to the child. Also you cannot (without shooting yourself in the foot) do this in C++.
Suppose you had a method (FooBar) in SerializableHashtable which doesn't exist in Hashtable. If you were allowed to assign a Hashtable object to a SerializableHashtable reference, what would happen if you called FooBar?
It is possible for you to assign a SerializableHashtable object to a Hashtable reference.
Jared
jparsons@jparsons.org
www.prism.gatech.edu/~gte477n
|
|
|
|
|
But he can cast it to a SerializableHashtable .
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
|
Yeah, of course, or any other class derived from Hashtable .
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
So, i throw this idea away and store the Hashtable Object in a member of SerializeableHashtable. That will work ... Thanks a lot for your help
|
|
|
|