|
I'd use a Regular Expression; but maybe your teacher wants you to do it the hard way?
|
|
|
|
|
I've written an addon for Firefox that I want to port to IE8. Unfortunately I'm having trouble getting to the right documentation and I've still not been able to figure out what language should I develop the BHO in. C++ or C#? Or are there other options too?
Any links to documentation and online resource that could help me would be appreciated.
|
|
|
|
|
Preferred?? No. C++ would be the "preferred" language since all of the header files for this only work in C++. Using C#, you'd have to recreate all the structures, contants, P/Invoke headers, ... yourself, by hand.
|
|
|
|
|
Thanks for the reply Dave.
Turns out that not only is C# not the recommended language, the recommendation is actually against using it. Only one instance of .net CLR will be loaded and if two BHO have conflicting versions of .net, one of them is going to be out of luck. Also, each tab will need to load the .net library making this an expensive operation.
|
|
|
|
|
Assembly.Load(...) requires to give the fully qualified name, so does it mean Assembly.Load(..) can load only assemblies present in GAC?
Can a Assembly.Load(...) method load a private assembly?
|
|
|
|
|
shivapriyak wrote: Assembly.Load(...) requires to give the fully qualified name, so does it mean Assembly.Load(..) can load only assemblies present in GAC?
Nope, it can also load an assembly that's present in-memory[^] (as an array of bytes), and you can also load an assembly by giving a partial name[^]. This snippet from PIEBALDConsult may help;
System.Reflection.Assembly assm ;
name = System.IO.Path.GetFileNameWithoutExtension ( Filename ) ;
assm = System.AppDomain.CreateDomain ( name ).
Load ( System.IO.File.ReadAllBytes ( Filename ) ) ;
I are Troll
|
|
|
|
|
5!
|
|
|
|
|
It is a nice snippet!!
I are Troll
|
|
|
|
|
LoadWithPartialName is deprecated. Don't use it.
It will happily load the newest version of the assembly that's available on the machine. If you think that's what you need, please think again. At some point in the future, this newest version is very likely to be incompatible with your app.
In fact, using LoadWithPartialName in a .NET 2.0 app will crash as soon as a newer .NET 4.0 version of the library is installed.
|
|
|
|
|
Daniel Grunwald wrote: LoadWithPartialName is deprecated.
Thanks for mentioning it, it's also in the documentation that was linked to.
Daniel Grunwald wrote: At some point in the future, this newest version is very likely to be incompatible with your app.
Yup. Even if all the signatures stay the same, something is bound to break sooner or later, and it's always best to be prepared.
Daniel Grunwald wrote: In fact, using LoadWithPartialName in a .NET 2.0 app will crash as soon as a newer .NET 4.0 version of the library is installed.
It's not obsolete in 2.0, and I doubt that Microsoft will bring out 4.0 with a feature[^] that breaks a lot of existing code
I are Troll
|
|
|
|
|
In my app, there was a use of Assembly.LoadWithPartialName("System.Xml") . It caused a crash when .NET 4.0 was installed on the machine.
The documentation of LoadWithPartialName mentions this problem in the exception table:
BadImageFormatException : assemblyFile is not a valid assembly.
-or-
Version 2.0 or later of the common language runtime is currently loaded and partialName was compiled with a later version.
|
|
|
|
|
Daniel Grunwald wrote: In my app, there was a use of Assembly.LoadWithPartialName("System.Xml"). It caused a crash when .NET 4.0 was installed on the machine.
Because it tries to load a 4.0-assembly in a 2.0 application.
I agree that you shouldn't just ask the framework for a dll, but I assumed that you were talking about assemblies that you created yourself, not any of the assemblies from the system.
I are Troll
|
|
|
|
|
Hi, all,
In my Windows Form, there is a TableLayoutPanel control having about 15 rows(column count is not taken into account) and a Button, and in the button_Click event, there are two methods RemoveUpperRow() and AddNewRow() inserted as follows:
modified: Sorry, just noticed there are sth else I need to provide before you check my codes.There are also one label in each cells in the first column, and this is the reason I am able to do rolling by the following codes.
private void RemoveUpperRow()
{
Control c = tlp_MouseArea.GetControlFromPosition(0, 1);
tlp_MouseArea.Controls.Remove(c);
tlp_MouseArea.RowStyles.RemoveAt(0);
for (int i = 1; i < tlp_MouseArea.RowCount; i++)
{
c = tlp_MouseArea.GetControlFromPosition(0, i+1);
if (c == null)
break;
TableLayoutPanelCellPosition controlPosition = new TableLayoutPanelCellPosition(0, i);
tlp_MouseArea.SetCellPosition(c, controlPosition);
}
}
private void AddNewRow()
{
tlp_MouseArea.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 18F));
#region new label and its settings
Label lbl_New = new Label();
if (int.Parse(tlp_MouseArea.GetControlFromPosition(0, 13).Text) < 15)
{
lbl_New.Text = Convert.ToString(int.Parse(tlp_MouseArea.GetControlFromPosition(0, 13).Text) + 1);
}
else
lbl_New.Text = "0";
lbl_New.Dock = DockStyle.Fill;
lbl_New.Font = new System.Drawing.Font("Tahoma", 8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Pixel, ((byte)(0)));
lbl_New.TextAlign = ContentAlignment.MiddleCenter;
#endregion
TableLayoutPanelCellPosition pos = new TableLayoutPanelCellPosition(0, 14);
tlp_MouseArea.SetCellPosition(lbl_New, pos);
tlp_MouseArea.Controls.Add(lbl_New);
}
My problem is that it works fine, but it seems to be too slow, and the whole form is flicking till the end, that's something nobody would want to see. So, is there anything wrong with my code? Would you give me some suggestions? Your kind help is so much appreciated!
Liang
modified on Friday, October 9, 2009 7:26 AM
|
|
|
|
|
How about using SuspendLayout and ResumeLayout ?
|
|
|
|
|
Hi,
Thanks for your reply. I've tried that one before, it didn't help. .
And I tried again after your post, it performs better than the first time, but problem still exists...
I guess, but not quite sure, it caused by that for loop in the first method...
Anyone else have better idea? Thank you.
modified on Friday, October 9, 2009 8:51 AM
|
|
|
|
|
You can try to enable DoubleBuffering ont he form, but, this is probably not going to fix your problem either. You have to keep in mind that redrawing controls all the time (while you move the grid) is expensive. The more controls you have, the longer the redraw is going to take.
|
|
|
|
|
Thank you for replying me. I understand what you said. And I googled a lot as well. But since I need to do this in my form, I will take both of your advices. And thanks again! cheer!
|
|
|
|
|
hiiiii...
i am new to this field.....
i hv been working on textbox to validate it using custom validation so that it will take more than 5 characters...
any body hv the answer......plz share wid me...
|
|
|
|
|
What's the problem? What did you try?
|
|
|
|
|
actually i am trying to design a registration page where i want to validate this userid's textbox field so that it will not take less than 5 characters...
so should i use custom validator or go by any otherway? if any other way can u specify..........
|
|
|
|
|
Alright ASP.NET again.. Sorry can't help
|
|
|
|
|
Why bold the entire post?
There are plenty of ways to do these things. Assuming you are speaking of web project, you can do this through the validation controls available. You can have a regular expression validator to do this.
In case of windows forms, use Validating event of the textbox to check text length.
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
but regular expression validator r only used to validate the kind of fields like e mail ,phone no, etc.......i think...
|
|
|
|
|
No, a RegEx can be used to do this too. Though, there are other, lighter weight methods to use. If you need to do further validation, RegEx would probably be the way to go.
|
|
|
|
|
Hi all,
How to call a C# method from a javascript. for example i am fetching a document.activeElement.value and i want to send this value to the C# method.
Is it possible, if some one knows this pls help me
thanks in adavance...
|
|
|
|