|
Hi everybody,
I need your advice/help. I have to create a .NET app that implements our existing DHTML tools.
I use the AxWebBrowser to host them, but now comes the problem. Our original app used to talk to some ASP page via XMLHttp (javascript). In the .NET app the javascript in the webbrowser has to talk to my .NET methods.
To put it simple: how can the contents of an AxWebBrowser talk to its hosting environment (my .NET app)?
I thought of creating an COM object, which I put on my HTML pages, and invoke their methods from the HTML, and the COM object would then throw events that will be caught by .NET (using the mshtml to locate the object). But obviously this is not very neat, and make everything go asynchronous.
Another option would be using MsHtmHstInterop, explained somewhere on the code project, but I didn't find more articles about it, so I wonder if it is good enough.
Thank you for your help.
|
|
|
|
|
Search the articles for Interop and you should find a few articles (including mine) which should give you all that you need.
There are 10 kinds of people in the world.
Those that read binary...
...and those who don't.
|
|
|
|
|
The IE control enables you to display a webpage. When the user clicks on a link/button that takes them to another page, an event is triggered "BeforeNavigate2".
I format my URL in the webpage according to my parsing format so i can determine if i need to display it using my application forms or through standard HTML viewer.
//***** this is the code in my HTMLViewer control which wraps the IE COM control
private void AxWebBrowser1_BeforeNavigate2(object sender, DWebBrowserEvents2_BeforeNavigate2Event e)
{
NavigationInfo ni = NavigationInfo.ParseURL((string)e.uRL);
if (ni.IsInternalURL) //
{
if (NavigationRequested!=null)
{
NavigationRequested(ni); //raise event
}
e.cancel = true;
}
}
'******* code in the form which uses the HTMLViewer control and handles the NavigationRequested event
private void HtmlViewerCC1_NavigationRequested(HTMLViewerCC.NavigationInfo ni)
{
Form f = null;
switch (ni.ObjectType)
{
case ObjectTypeCodes.Users:
f = new frmUsers(ni.Value);
break;
case ObjectTypeCodes.Company:
f = new frmCompany(ni.Value);
break;
default:
throw new Exception("Not supported");
}
f.ShowDialog();
}
|
|
|
|
|
Hi all!
I have a problem, when i create a client application (C# language) to remoting the DLL (C# language) on server (thus DCOM) that is registered.
source code is below:
Type t = Type.GetTypeFromProgID("Class_Name", "Server_Address");<br />
object o = System.Activator.CreateInstance(t);<br />
Class_Name =(Class_Name) o;
Rerult:
If "Server_Address" = null then program work well.
but "Server_Address" = "localhost" or IPaddress then I received the exception:
'System.InvalidCastException': Specified cast is not valid.
Why is it? I need everyone help me soon!
Thanks very much!
sangtao
|
|
|
|
|
I'm having a problem understanding how to register Windows Shell extensions, specifically for PropertySheet extensions and their handlers.
I am not too happy with the way it's done here -
http://www.codeproject.com/cs/miscctrl/HadiPropertySheet.asp
- "Property Sheet Shell Extension in C#"
I think this can be done with PInvoke, rather than RegAsm.exe. Obviosuly, the batch file for putting the keys and appropriate GUID into the registry can be done in code (and would be less error-prone).
Also, can anyone direct me to an example in VB.NET for the same sort of thing that's described in that article? That is, a property sheet extension example.
Thanks for any help - Ian Thomas
|
|
|
|
|
Hello,
I am a newbie in Crystal Reports. I need to sort the report based on the column that the user sets in the windows form. How do I do it?
I've been googling with virtually no help
Thanks in advance.
Regards,
Zishan
|
|
|
|
|
I don't think you can tell the report to sort from your code. One solution is to build many report, one for each column which the user can choose.
<italic>Work hard, Work effectively.
|
|
|
|
|
Thanks for replying. There should be a way. I got a sample code, Its in VB, I tried it in C# but for some reason.. it doesn't work for me. Here's the code :
Dim crSortDirection As SortDirection
Dim crDatabaseFieldDefinition As DatabaseFieldDefinition
Dim crSortField As SortField
Dim iSortItem As Integer = 0
crDatabaseFieldDefinition = crReportDocument.Database.Tables(0).Fields(6)
crSortField = crReportDocument.DataDefinition.SortFields(6)
crSortField.Field = crDatabaseFieldDefinition
'crSortField.SortDirection = SortDirection.AscendingOrder
crSortField.SortDirection = SortDirection.DescendingOrder
There is no explanation available for the code. No matter what SortField I pass, it keeps throughing CrystalDecisions.CrystalReports.Engine.InvalidArgumentException -> Invalid SortNumber.
Can you explain now?
Zishan
|
|
|
|
|
Ar you sure your C# syntax is correct? In case you are passing a groupfield instead of a databaseField, use the base class:
FieldDef = new FieldDefinition ();
FieldDef = Report.Database.Tables [0].Fields [6];
Report.DataDefinition.SortFields [0].Field = FieldDef;
Absolute faith corrupts as absolutely as absolute power
Eric Hoffer
All that is necessary for the triumph of evil is that good men do nothing.
Edmund Burke
|
|
|
|
|
Same problem Can I make a stored procedure and pass the "order by" parameter? I think that's going to solve the problem. I am using Crystal Reports that comes with the VS.net 2003. How can I call a stored procedure and pass the parameter?
Many thanks.
Zishan
|
|
|
|
|
I have used crystal in a few of my apps and the way I handle sorting is by sorting the datasource ( i use a dataset as the source ). So based on a selected column by the user, sort the dataset into the desired order or load the data into the dataset by specifying the SORT keyword in the sql statement when retrieving the data.
Hope this helps.
Craigo
|
|
|
|
|
Craigo, I tried what you told me.. it is picking up all the records in the table without any order. I commented the t.SetDataSource line.. still the same result. I am not sure if this is the right way to define Data Source. Here is my code :
Report2 t = new Report2();
string Query = "Select * from Orders order by ordertype asc";
SqlComm.CommandText = Query;
SqlDataAdapter da = new SqlDataAdapter(SqlComm);
DataSet data = new DataSet();
da.Fill(data);
t.SetDataSource(data);
this.Viewer.ReportSource = t;
Zishan
|
|
|
|
|
2 Things you can try.
1) change the code where you set the datasource to :
t.SetDataSource(data.Tables[0])
2) Add the line: t.EnableSaveDataWithReport=false;
after you have set the datasource
Let me know how you get on
Craigo
|
|
|
|
|
Hey Craig, thanks a lot man.. you saved my life.. although I don't have t.EnableSaveDataWithReport property but the problem is now solved.. Thanks for your help!
Zishan
|
|
|
|
|
hi to all,
i have developped a web service in c# .net on my local machine (localhost).
then i create a c# win application and i added the web reference (on the local host) to cosume this web service and everything works fine.
how can i put the web service on the server (windows 2000 server). and then where can i add the web reference to my c# win application to cosume it.
do i have to install the .net frame work on the server and then copy my web service project on that server ?
note that all the client terminal does not have an IIS
best regards and thanks in advance
fady
|
|
|
|
|
You have to install iis to your server and deploy your service there.
Then you can add a web reference to the server
Eg: http://ipAddress/......
Regards,
charith
|
|
|
|
|
thanks to your reply charith,
do i have to install .net framework on the server or not ?
best regards,
fady
|
|
|
|
|
Hi fady
I think you have to install the framework.Not sure!
Sometimes it might work without the framework..
regards;
charith.
|
|
|
|
|
thanks charith,
i will try with the .net framework
thanks to your reply again
fady
|
|
|
|
|
charith@ramedian.com wrote:
Sometimes it might work without the framework..
Nothing .NET works without the framework....ever (I cant see how you could say "sometimes it might work" )
|
|
|
|
|
Thanks
|
|
|
|
|
I have written a webservice using ASP. There is a class named ReferenceDetails. I can add the webservice to my client side
and create a object of type ReferenceDetails.No problem!
private int _intRefID;
private int _intPatientID;
private int _intDoctorID;
private DateTime _beginDateTime;// = new DateTime();
public ReferenceDetails()
{
this._beginDateTime = new DateTime();
}
I have written another class at the backend containing ReferenceDetails object;
private ReferenceDetails _refDetails = new ReferenceDetails();
public RemindDetailsWrapper()
{
}
The problem is when i am creating a RemindDetailsWrapper() object at the client side it doesn't contain ReferenceDetails object.
Thanks :
|
|
|
|
|
Salam,
I have a rectangle(whose width, height etc is in millimeters) and a string. I want to know how much(no. of characters) of the string can be drawn in that rectangle keeping in view word breaks, line spacing etc. I have used MeasureString but the characters given by it are greater than actual that can be drawn in that rectangle.
|
|
|
|
|
How have you used MeasureString? It does not return a number of characters but the size needed to draw the string.
Have you specified the same font and size for MeasureString as you use when you draw the text?
---
b { font-weight: normal; }
|
|
|
|
|
Hi
If I have a class Person eg:
Class Person
{
private int identity;
public int Identity
{
get
return this.identity;
set
this.identity = value;
}
How can I get the value of identity (for example) using Reflection if I use the following type of code.
Person person = new Person();
this.DoSomething(person);
public void DoSomething(object obj)
{
//int identity = ???????;
Console.Writeline("Identity = " + identity);
}
}
I tried using the Type.PropertyInfo and GetValue, but the help documentation is not that clear and I did not manage.
Can anybody help me with an example perhaps.
Thanks.
Kobus
|
|
|
|