|
Hello.
Help, please.
I'm trying to call a CCW object from an asp file. I registered a CCW with regasm.exe and then installed with gacutil.exe.
So, in asp is written:
try
{
objCheck = Server.CreateObject(rstData.Fields("LibName").Value);
blnAllowed = (objCheck.Permissions() & 0x01 != 0);
}
catch(e)
{
%>
/*
// LibName: <%=rstData.Fields("LibName").Value%>
// ERROR: <%=e.description%>
*/
<%
blnAllowed = false;
}
And I get an error:
// LibName: OilMiningBalance.Rep_Struct
// ERROR: Object reference not set to an instance of an object.
The name of CCW is correct, but then what's the matter with it?
vital
|
|
|
|
|
bva_bva wrote:
The name of CCW is correct, but then what's the matter with it?
The error is stating you are trying to access a variable/object that you haven't declared yet. Try declaring objCheck before calling Server.CreateObject .
-Nick Parker
DeveloperNotes.com
|
|
|
|
|
Nick Parker wrote:
The error is stating you are trying to access a variable/object that you haven't declared yet. Try declaring objCheck before calling Server.CreateObject
objCheck is declared as follows:
var strSQL, rstData, objCheck, blnAllowed;
strSQL = "SELECT Id, LibName, ShowProhibited" +
" FROM PrintDoc";
rstData = dbConf.Execute(strSQL);
, but it isn't working yet.
|
|
|
|
|
How do we associate a file type with an application.
Plus how do we add our own items to the context menu ( not in the application)?
Like winzip ..when u right click a folder it provides the option of zipping...
how do we do that for our application??
|
|
|
|
|
I believe creating an .MSI setup project will allow you to do associate file types. MSDN has lots of information on this.
Adding custom items to the sytem context menu will probably require some registry modification. Search this forum or google, I'm sure it has come up in the past.
The graveyards are filled with indispensible men.
|
|
|
|
|
While MSI does allow you to create those (like the other poster stated), you don't have to use that. Even then, you must still add the file type associations to the package project.
You should first understand how these are done, because you could even have your application do this the first time it starts up, or even ensure that it owns the association (but you should ask the user for such an option, sort of like Windows Media Player, QuickTime, and RealOne do). See the MSDN article, Introduction to File Associations[^], for more information.
-----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 have a framework that allows me to create a wizard, by dynamically loading controls. I've found a similar framework on the web, in VB.NET. Mine is successfull at maintaining viewstate in the postback, so I can store/renew the data. The other one stores data in session state (yuck), but also maintains viewstate. This other one, however, can catch click messages in user controls that are dynamically loaded ( so I have a user control for the wizard, it shows user controls for pages, and a page contains a user control, with a button/click event ). I converted it from VB to C#, and now it does not catch click events either. Is this a bug in the C# implimentation, or am I missing something else ? I've tried to impliment IPostBackHandleEvent and it does not get called, I've tried assigning my click event in the ascx and in code. I have worked on it all weekend, and am now desperate and very sad.
|
|
|
|
|
does the page actually do a reload, but without firing the event? I have seen this, normally due to mysteryously disappearing eventhandlers. If I remembe correctly, i had to add the references to the back end file of the controls, and everything was ok from there.
leppie::AllocCPArticle("Zee blog"); Seen on my Campus BBS: Linux is free...coz no-one wants to pay for it.
|
|
|
|
|
tha's exactly the problem. Are you saying to add variables in the .cs file for the controls ? If so, I did that, it's not helping.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
|
There's a lot of it, but I'll try to post the essence of it.
I've got a Wizard class, which simply contains ascx files, each of which is a page in my wizard. It has a method called LoadControl which loads the wizard page into a placeholder on the page. This method takes a boolean flag, it is called in OnInit to load the control so that ViewState is restored, then called again in PageLoad, where it also sets up navigation buttons based on methods defined in the Interface that the wizard pages must impliment. I've looked at the HTML to ensure that the ID's are the same every time, and put in code to make sure that there are no automatically generated IDs anywhere. The current page ID is stored in viewstate, and the events that increment this are also working fine. It works really nicely, it loads the old page, then stores the values in the page into viewstate, then the event is fired and the new page is loaded, and any state restored. The problem comes with another control I've created, which is itself a composite of two controls we've written. My control binds these two controls to work as a particular view to browse our database, and a button that causes the view to flip between the two controls. This button is the event that is never fired in C#, although when I found an example in VB on the Visual Studio magazine site, it works fine. Porting it to C# also leaves me with events that don't fire. When Visual Studio finally wakes up from sorting out source control, I'll post some code.
The control gets loaded in my WizardControl like this:
override protected void LoadViewState(object savedState)
{
if (savedState != null)
{
base.LoadViewState(savedState);
LoadControl(false);
}
}
and then like this:
private void Page_Load(object sender, System.EventArgs e)
{
if (wizardControl.Controls.Count > 0)
{
IWizardPage wizardPage = wizardControl.Controls[0] as IWizardPage;
if (wizardPage != null)
{
pageData[wizardPage.PageName] = wizardPage.GetPageData();
Session[cPageData] = pageData;
}
}
LoadControl(true);
RestorePageData();
}
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
It turns out that my buttons were being dynamically created at runtime by their host, in OnPreRender. Moved their creation to OnInit and now all is well. Thanks for looking.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
I developed a WEB Forms page using C#. One of the bottons in the page says: Select File. When clicking this, I need to show a File Dialog showing files of client machine, once selected the file the program will open it and read data line by line. For File Dialog, I need the "using System.Windows.Forms;" but as I am using WEB forms, program does not allow me to include ....Windows.Forms.
How can I solve this problem? Is there an special File Dialog in Web Forms??
best regards
|
|
|
|
|
You can't show FileDialog on client's computer with Asp.Net...
If you want user to choose file use html input with type set to file.
<input type="file" ..>
|
|
|
|
|
How can I convert a bitmap from one format to another. (For example, 256 colour to 24-bit colour)
|
|
|
|
|
How do we execute a command line command in a Windows Forms environment?
thanks
|
|
|
|
|
|
Thank You!
|
|
|
|
|
I found www.thecodeproject.com just before a week.Next week i asked a question "how to control web components in winform by embeding a browser(ie)" and i didn't thought so many people have took focus on it.So i am appriciated your help.But i am a beginner of programmer,so can you offer me a specific application example that is windows applicatin embeded a browser and we can draw Web componet such as TextBox on the browser interface?thank you for your help very much. myEmail:kiss1979@sohu.com
ok
|
|
|
|
|
I have an older example on a different site that I'm currently porting to CodeProject. Source is available from that site as well. The site itself bites.
-----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-----
|
|
|
|
|
if i put a div element on the face of browser and set webconpontnet on the div, through this method can get the same result?
ok
|
|
|
|
|
No, you have to use the <object> tag. Please read my article and for more details, see Deploying a Runtime Application in Internet Explorer[^] in MSDN. If you give the control and ID and you create a class interface for the control that uses [InterfaceType(ComInterfaceType.InterfaceIsIDispatch)] attribute (on ther interface), with [ClassInterface(InterfaceType.None)] on the control (which implements the class interface as the first interface), you can access properties and call methods on the control like any other ActiveX controls. You should not use InterfaceType.AutoDual or InterfaceType.AutoDispatch for the class interface. See Nick Parker's Creating a CCW for COM-enabled non-.NET Applications[^] for more details.
-----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 know you mean,that is use winform control in web application.The method just as using ActiveX in web. But the .net framework is required in client.
Did you mean we can move the control in web using the method you tell about a week ago?
thank you!
|
|
|
|
|
Of course an embedded Windows Forms control requires the .NET Framework to be installed on the client, just like Java applets require a JRE and ActiveX requires IE. If you read my article, you'd see that this is treating a Windows Forms control in a similar fashion to an ActiveX control (it uses the <object> tag with a different classid value), and it can be scripted so long as the control uses dispatch interfaces (automation) that are exposed to the scripting host. It's all in my article.
Note, though, that this has nothing to do with ASP.NET. It can be embedded into plain HTML documents, ASP, PHP, or anything, since it is completely client-side.
-----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 see.
Now i am designing a application that enable users as server side can configurate some componets on the platform (just a winapplication embedded browser i said first time) the users as client side can watch the results.As you know the client side should comunication with server realtime to get data.
Cmmonly we can refresh the browser to link to the server to get data,but when application need do this per 2 second this method cann't been used.Now i am confused about whether to design web components(how keep communicaion between server and client in background process) or winform component (use DCOM to keep their communicaion?anyother method?) .So, please give me some advice. thank you.
非常感谢您的帮助
|
|
|
|