|
Hello,
How can i block Pop-Ups in a AxBrowser Component? has a way to do this?
Thanks.
|
|
|
|
|
|
|
|
Man, the other topic wasn't well written nor well understood :\, so i'm still without answser!
The articles I found didn't helped me to find out how to block Pop-ups directly
|
|
|
|
|
Lol o.o
I got it
the answer:
NewWindow Event
private void web_NewWindow(object sender, AxSHDocVw.DWebBrowserEvents2_NewWindow2Event e)<br />
{<br />
e.cancel = true;<br />
}
Thanks
|
|
|
|
|
Being an intermediate programmer, I'm having a hard time understanding the documentation that is out there regarding this topic.
Let's say I have two objects, derived from ClassA and ClassB. The lifecycle of Class B is as follows:
-ClassA instantiates an instance of ClassB, and places this object into, say, a hashtable.
-ClassB does its thing for a while, but then becomes useless.
-ClassA removes ClassB from the hashtable. Now, there is no reference to that object within ClassA.
What happens to ClassB? Is it still floating out there in memory? Do I need to tell ClassA to actually destroy the ClassB object, or does the GC already know that ClassA no longer refers to ClassB, and therefore destroys it automatically?
Thanks for your help.
|
|
|
|
|
tantiboh wrote:
Is it still floating out there in memory?
Yes, for an indeterminate amount of time, until the GC puts the memory back into the general pool ("collects" it).
tantiboh wrote:
Do I need to tell ClassA to actually destroy the ClassB object
No. Not unless ClassB was using some non-managed resources.
does the GC already know that ClassA no longer refers to ClassB, and therefore destroys it automatically?
Yes.
It's hard to get ones arms around this, coming from C++. There's a lot of good articles out there. Try googling on "Understanding .NET Garbage Collection".
Marc
MyXaml
Advanced Unit Testing
YAPO
|
|
|
|
|
I'm using a System.Timers.Timer object. How can I get (or calculate an estimate for) the amount of time remaining on the timer? The estimate wouldn't have to be any more accurate than a few dozen milliseconds.
It's an ASP project, so System.Windows.Forms.Timer is not available.
Thanks for you help.
|
|
|
|
|
tantiboh wrote:
How can I get (or calculate an estimate for) the amount of time remaining on the timer?
Here's an idea: derive your own timer that hooks the Elapsed event. Whenever the timer fires, do an intervalStartTicks=DateTime.Ticks or something.
Have a method in your derived class called "RemainingTime", or something like that, that gives you Interval - DateTime.Ticks - intervalStartTicks, doing the appropriate unit conversions.
You might also want to provide your own Start method that sets the intervalStartTicks as well.
Marc
MyXaml
Advanced Unit Testing
YAPO
|
|
|
|
|
Hi everybody!
In Java such a piece of code
<br />
javax.swing.JFrame frame = null;<br />
try<br />
{<br />
frame = Class.forName("javax.swing.JFrame");<br />
}<br />
catch (Exception e) {}<br />
would create a new JFrame object (of course if the string provided isn't a correct name exceptions are thrown).
Is there s similar mechanism in C#? Becouse if there is it would let me ommit many string.Equals() and is calls and make the code a whole lot easier to read.
|
|
|
|
|
Look at System.Activator.CreateInstance, or you can do the same if you already have a reference to an assembly.
I can imagine the sinking feeling one would have after ordering my book,
only to find a laughably ridiculous theory with demented logic once the book arrives - Mark McCutcheon
|
|
|
|
|
All Happy Now!
We have an existing ASP.NET app (C# backend) that was originally written with weakly named backend objects, distributed to our customer's via traditional "XCOPY" (actually InstallShield, but just dropping files in the right location), so that all of the necessary DLL's are installed in the /bin directory of the default website. This works fine for just one app.
Now, we are in the process of adding additional applications to our existing one, and in order to do that, we are strong-naming our components and trying to install them to the GAC, so that they can be globally referenced. I have successfully strong-named all of our components, and can put them into the GAC without issue as well. However, when I remove the /bin directory after having placed the components in the GAC, I get "Object Not Found" errors when trying to run the app.
Is there something I need to change in the way my .DLLs reference each other, so that the app will search the GAC when loading?
This is somewhat urgent as we are midway through the design process and starting to reconfigure our existing code. If our distribution plans are misinformed, we need to know now so we can lay a better path.
Thanks for any help we can get!
|
|
|
|
|
This doesn't directly answer your question, but I wouldn't put assemblies into the GAC during development. This can be a real pain, because you have to specifically tell gacutil to uninstall the assembly first or force it to re-install over an existing install:
gacutil /f /i myassembly.dll
But this fails if you've installed the assembly with MSI, because it can only be uninstalled using MSI!
It's easier to add things to the GAC as part of installation and test the installation separately--NOT on the development platform. Use VirtualPC or something to ensure a clean, reproducable install environment.
Marc
MyXaml
Advanced Unit Testing
YAPO
|
|
|
|
|
Thanks, but distribution is what I'm trying to test at this point. We've already got the development environment running and compiling together with the strong-named assemblies. It's when I try to test how the application works with its core dlls in the GAC that I'm running into trouble.
One thing that I'm doing that may not be right is I'm using the Windows Explorer add-on to install the dlls to the GAC, not GACUtil. I wouldn't think that's the problem, because I get the same failures when I use the InstallShield distribution. So I figured it has something to do with how we reference the DLLs.
Thanks for looking and responding!
Kerry
|
|
|
|
|
|
I imagine this topic has been resolved many times, but I beg for your help.
I am trying to run the most simple Remoting example and simply it refuses to work in my computer.
Why? I don't know but this is really bother me.
You can see one example that also can not run in my computer following the link:
http://www.codeproject.com/csharp/RemotingChatSample.asp
Could you please tell me what is my problem.
Regards
Ewing
|
|
|
|
|
Hi;
If you are running this accross a network, have you check to make sure that no firewall are blooking the connection? if you are running accross a network try running it on the same machine, localhost and see if you have the same problem.
-Fernando
|
|
|
|
|
i am connecting with sqlserver database ,then i need to acces that user which is in my textbox ,but no user comming from it.
code is as follows:
sqlConnString="server= your server; database= ;user id=;password=;";
sqlConn = new SqlConnection(sqlConnString);
sqlConn.Open();
sqlCmd = new SqlCommand(“select username,password from table where username=@textbox1.text”);
sqlDataAdapter da = new SqlDataAdapter();
da= cmd.executeReader()
If da.read()
{
responser.redirect(“loginsuccess.aspx”)
}
else
{
response.write(“invalid login.aspx”)
}
+++++++++++++++++++++++++++
error is this
System.Data.SqlClient.SqlException: Must declare the variable '@TextBox1'. at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream) at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior) at System.Data.SqlClient.SqlCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior) at System.Data.Common.DbDataAdapter.FillFromCommand(Object data, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet) at ASP.UserInfo_aspx.Page_Load()
|
|
|
|
|
cishi_us wrote:
Must declare the variable '@TextBox1'
Read up on how to use the SqlParameter object. Also, just use "@TextBox1", not "@TextBox1.Text".
Marc
MyXaml
Advanced Unit Testing
YAPO
|
|
|
|
|
I have finally solved my dropdownlist databinding issue....Next prolem. I now have a selected value. That value correpsopnds to a row of data. How do I access this data?
Here is my code.
Thanks in advance
private void Page_Load(object sender, System.EventArgs e)<br />
{<br />
DropDownList DropList = new DropDownList();<br />
<br />
DropList.ID = "AirportList";<br />
DropList.AutoPostBack = true;<br />
<br />
DropList.SelectedIndexChanged += <br />
new EventHandler(this.Selection_Change);<br />
<br />
oleDbDataAdapter1.Fill(dsn_AirportList1,"tblAirport");<br />
Session["DSN_AirportList"] = dsn_AirportList1;<br />
DropList.DataSource = dsn_AirportList1;<br />
DropList.DataTextField = "AirportName";<br />
DropList.DataBind();<br />
if(!IsPostBack)<br />
{ <br />
DropList.SelectedIndex = 0;<br />
}<br />
PlaceHolder1.Controls.Add(DropList);<br />
}<br />
#region Web Form Designer generated code<br />
override protected void OnInit(EventArgs e)<br />
{<br />
InitializeComponent();<br />
base.OnInit(e);<br />
}<br />
<br />
private void InitializeComponent()<br />
{ <br />
this.oleDbDataAdapter1 = new System.Data.OleDb.OleDbDataAdapter();<br />
this.oleDbSelectCommand1 = new System.Data.OleDb.OleDbCommand();<br />
this.oleDbConnection2 = new System.Data.OleDb.OleDbConnection();<br />
this.dsn_AirportList1 = new DSN_AirportList();<br />
((System.ComponentModel.ISupportInitialize)(this.dsn_AirportList1)).BeginInit();<br />
this.oleDbDataAdapter1.SelectCommand = this.oleDbSelectCommand1;<br />
this.oleDbDataAdapter1.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] {<br />
new System.Data.Common.DataTableMapping("Table", "tblAirport", new System.Data.Common.DataColumnMapping[] {<br />
new System.Data.Common.DataColumnMapping("AirportCode", "AirportCode"),<br />
new System.Data.Common.DataColumnMapping("AirportID", "AirportID"),<br />
new System.Data.Common.DataColumnMapping("AirportName", "AirportName"),<br />
new System.Data.Common.DataColumnMapping("City", "City"),<br />
new System.Data.Common.DataColumnMapping("Latitude", "Latitude"),<br />
new System.Data.Common.DataColumnMapping("Longitude", "Longitude"),<br />
new System.Data.Common.DataColumnMapping("State", "State")})});<br />
this.oleDbSelectCommand1.CommandText = "SELECT AirportCode, AirportID, AirportName, City, Latitude, Longitude, State FROM" +<br />
" tblAirport";<br />
this.oleDbSelectCommand1.Connection = this.oleDbConnection2;<br />
this.oleDbConnection2.ConnectionString = @"Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Registry Path=;Jet OLEDB:Database Locking Mode=1;Data Source=""D:\MGDevelopment\DropDownList2\DB\simdac_be.mdb"";Jet OLEDB:Engine Type=5;Provider=""Microsoft.Jet.OLEDB.4.0"";Jet OLEDB:System database=;Jet OLEDB:SFP=False;persist security info=False;Extended Properties=;Mode=Share Deny None;Jet OLEDB:Encrypt Database=False;Jet OLEDB:Create System Database=False;Jet OLEDB:Don't Copy Locale on Compact=False;Jet OLEDB:Compact Without Replica Repair=False;User ID=Admin;Jet OLEDB:Global Bulk Transactions=1";<br />
this.dsn_AirportList1.DataSetName = "DSN_AirportList";<br />
this.dsn_AirportList1.Locale = new System.Globalization.CultureInfo("en-US");<br />
this.Load += new System.EventHandler(this.Page_Load);<br />
((System.ComponentModel.ISupportInitialize)(this.dsn_AirportList1)).EndInit();<br />
<br />
}<br />
#endregion<br />
<br />
void Selection_Change(Object sender, EventArgs e)<br />
{<br />
DropDownList DropList = <br />
(DropDownList)PlaceHolder1.FindControl("AirportList"); <br />
<br />
string xxx=DropList.SelectedItem.Value;<br />
int yy=DropList.Items.Count;<br />
}<br />
|
|
|
|
|
I figured it out......Too easy!
|
|
|
|
|
How you you list the branches of say, System.Windows.Forms ???
(I want to make code-completion in a .cs text editor)
-ProtoArmor
|
|
|
|
|
You can always look in System.Reflection for hints. You should also realize that assemblies and namespaces are not tied together. There might be more stuff in a given namspace that are in assemblies that aren't loaded.
|
|
|
|
|
From my AUT project, here's how I get the classes in an assembly for a particular namespace:
private ClassCollection GetClassCollection()
{
ClassCollection classCollection=new ClassCollection();
Type[] types=assembly.GetTypes();
foreach (Type type in types)
{
if (type.IsClass)
{
MethodInfo[] methods=type.GetMethods(Options.BindingFlags);
foreach (MethodInfo methodInfo in methods)
{
if (methodInfo.DeclaringType.Namespace==namespaceName)
{
string className=StringHelpers.RightOfRightmostOf(methodInfo.DeclaringType.FullName, '.');
Type t=methodInfo.DeclaringType;
classCollection.Add(className, new ClassItem(assembly, namespaceName, className, type));
}
}
}
}
return classCollection;
MyXaml
Advanced Unit Testing
YAPO
|
|
|
|
|