|
topcatalpha wrote: What happens here? A huge .net bug ?
No. A disabled control doesn't get the mouse message. It's going to the topmost control that's still enabled.
|
|
|
|
|
Seems pretty dangerous to me.. clicking on something you can't see...
i cannot see a good reasons to implement such thing, so i guess it's a shortcomming in dotnet or so..
how to work around this? settings everything disabled?
i really need usercontrols to be created before switching to keep up the speed when changing screens.
thx for the response.
Kurt
|
|
|
|
|
Normally, noone overlays a disabled control over the top of a bunch of other controls either.
topcatalpha wrote: settings everything disabled?
Yep.
topcatalpha wrote: i really need usercontrols to be created before switching
Switching what??
topcatalpha wrote: to keep up the speed when changing screens
The more controls you have, the slow repaint is going to be. Period - end of story. There's nothing you can do about that, other than limiting the number of controls on a form.
|
|
|
|
|
hi,
thx for the respond.
Dave Kreskowiak wrote: Switching what??
switching between screens was what i ment here.
i need to switch quickly between screen and creating them is extreemly slow. You can see al controls being build and shown seperatally.
As there is no such thing as a notebook (tabcontrol without the buttonss) in dotnet i create them and bring them to front and set visible when i need them to see.
Indeed more resource for starting up, but fast when switching if you do a .refresh after bringtofront.
For my users there's no waiting and seeing the screen being build also when a lot of controls are placed on the usercontrol.
Unless i'm totally wrong here in the way i work. Then please suggest an option to prevent the slow screen builds in dotnet.
So why i disable the top control? I have a treeview at the left side of the screen and depending on the selected item in the treeview the user can or cannot edit the main screen/usercontrol that is on top.
Thx again
Kurt
|
|
|
|
|
It sounds like you're trying to put your entire app on one form, which is not a good idea. If you do any data binding of controls, you'll find that becomes a headache in an environment like this.
If this is true and you are putting every on a single form, you've increased the time is takes to create that form. There's nothing you can do about it. Creating a control is a very expensive process. Multiple that by a couple of hundred times and it takes forever.
Also, I see no reason to use UserControls. It's probably the second most abused class next to a PictureBox control. UserControl is designed to make it easier to make "composite" controls. Say a TextBox and a Button combine to make something like a Browse control. You can either type a path in the TextBox or click the Button to browser for a filepath.
Did you know that the Form class derives from Control?? Yes, you can treat a Form just like any other control, like a TextBox or Button. Design each "page" of your notebook as a seperate form, setting the FormBorderStyle to None to get rid of the title bar. Then you from your TreeView you can create and destroy each form and place it in the right side of your screen just like placing a control. When you click a new item in the TreeView, Dispose the last form created and create a new one. Just remember to set the Form's TopLevel property to False before you add it to a container controls collection.
|
|
|
|
|
Dave Kreskowiak wrote: It sounds like you're trying to put your entire app on one form, which is not a good idea. If you do any data binding of controls, you'll find that becomes a headache in an environment like this.
You're right there, not for my usercontrols, but i had this problem with databindings for controls on tabpages. Seems controls are not created the first time, after showing the tabpage the binding remains...
Dave Kreskowiak wrote: If this is true and you are putting every on a single form, you've increased the time is takes to create that form. There's nothing you can do about it. Creating a control is a very expensive process. Multiple that by a couple of hundred times and it takes forever.
I use a mainform and usercontrols in a splitpanel. it takes indeed more time to startup the app (about 2 seconds including DB connection), therefore i have a splash/login screen. but after creating it remains very fast, i don't have to create them each time.
i guess this is a choice, fast startup and slow switching or slow startup and fast switching between screens.
Dave Kreskowiak wrote: Also, I see no reason to use UserControls. It's probably the second most abused class next to a PictureBox control. UserControl is designed to make it easier to make "composite" controls. Say a TextBox and a Button combine to make something like a Browse control. You can either type a path in the TextBox or click the Button to browser for a filepath.
I use them because they can be placed on controls and are reusable. In delphi i could give a form a parent and the form docks on that panel, but that doesn't work in C# dotnet. forms are not dockable on a splitpanel. are am i wrong here?
Dave Kreskowiak wrote: Did you know that the Form class derives from Control?? Yes, you can treat a Form just like any other control, like a TextBox or Button. Design each "page" of your notebook as a seperate form, setting the FormBorderStyle to None to get rid of the title bar. Then you from your TreeView you can create and destroy each form and place it in the right side of your screen just like placing a control. When you click a new item in the TreeView, Dispose the last form created and create a new one. Just remember to set the Form's TopLevel property to False before you add it to a container controls collection.
Guess this is the solution to my question.
Do you think using a form instead of a usercontrol will be faster ? or what is the advandage for using a form instead of a usercontrol?
Dave Kreskowiak wrote: Say a TextBox and a Button combine to make something like a Browse control.
Indeed in my case some buttons a grid and detailsfields no code behind it except for the inputfields.
I thought a usercontrol was the same like a frame in delphi. Place controls on it and make it availabe in the toolbar, just drag and drop it in designtime
Thx again.
Kurt
|
|
|
|
|
topcatalpha wrote: i guess this is a choice, fast startup and slow switching or slow startup and fast switching between screens.
Putting the controls for each page on a different form limits the number of controls you're creating on startup, and also limits the number of controls created each time a form is instantiated, so it's still pretty fast.
topcatalpha wrote: In delphi i could give a form a parent and the form docks on that panel, but that doesn't work in C# dotnet. forms are not dockable on a splitpanel. are am i wrong here?
Sure it does. Forms have a Dock property, just like any other control, and yes, it does work. The Dock property for a form doesn't show up in the Properties panel, but it can be set in code.
topcatalpha wrote: Do you think using a form instead of a usercontrol will be faster ? or what is the advandage for using a form instead of a usercontrol?
The UserControl is a bit lighter so it does create a little faster (milliseconds, I assure you.) The form has the advantage of maintaining its own BindingContext by default instead of inheriting the parent form's context.
You don't get to see a form in the ToolBox though like you do with a UserControl. But in an app like this, why would you want to?
|
|
|
|
|
OKay, Thx for you're support and good explanation.
Dave Kreskowiak wrote: You don't get to see a form in the ToolBox though like you do with a UserControl. But in an app like this, why would you want to?
A reasons i use it now is reusability for all other applications i'm gonna build, i do like RAD tools with controls in desigtime so i don't want to lose to much time just for building layout.
i also bind the buttons of my custom menu (custom control with the treeview at left) in designtime with my usercontrols. so no code to write here.
i drag&drop a menu, i drag&drop 10 usercontrols and for each button in the menubuttons i have a property named "Content" of type MyUserControl, i select a the corrsponding usercontrol for each button. And in 10 minutes i have a outlook applications with 10 screens that already works when running the program.
Same for assigning the events of the usercontrols. Just click in designtime, no typing code to assign events.
But i guess its just an 8 year old habbit of me, it's the way Borland always worked with the designers.
Maybe i'm getting to old for all this stuff. ...... just kidding.
Greetz,
Kurt
|
|
|
|
|
I'm busy parsing record layout templates, and I need to determine if a field is quoted or not. I'm try to use a RegEx, and so far I have ['\"].*['\"] to match either ' or " followed by zero or more chars, followed by either ' or "
My question is, how do I check that the closing quote mark matches the opening one?
|
|
|
|
|
You would need to make the .* non-greedy by adding a ?, like so:
['"].*?['"]
But this would match: "This has differing quotes'
So you would need to break it out to separate items:
(?:["].*?["]|['].*?['])
Or you could use a back-reference like so:
(?<1>['"]).*?\1
Basically, \1 traslate into what ever was captured by the first parenthesis.
If you need to provide an escape for quotes, so you can have a double quote inside double-quotes (e.g. "This is a \" test"), then you would need to do this:
(?<1>['"])(?:\\\1|.)*?\1
In this one, we want to check for the escaped quote in the "content".
Take care,
Tom
-----------------------------------------------
Check out my blog at http://tjoe.wordpress.com
|
|
|
|
|
Thank you Tom!
That's more than I needed, indeed I ended up using StartsWith() and EndsWith() to get the thing out, in case the boss asks to see it, but I'll be sure to revisit with your explanation and suggestions.
BTW, what does "non-greedy" signify?
|
|
|
|
|
Let's say you have the regex: ".*"
Then in the string: "One", "Two"
It would be greedy, meaning it would match " with the first quote then One", "Two with the .* and finally " with the last quote.
If you change the regex to: ".*?"
Then the .* portion would be non-greedy, meaning it would match the first " with the first quote then One with the .*? and finally " with the last quote. And you would get a second match (if you called GetMatches over GetMatch), which would match the "Two" portion.
Does that make sense?
Take care,
Tom
-----------------------------------------------
Check out my blog at http://tjoe.wordpress.com
|
|
|
|
|
Yes, thank you. I've gotten this before, but only during the 'heat of the moment' Yours is a fine example that explains it permanently to me.
|
|
|
|
|
I use the following code to login to a crystal report based arround an ms access database
<add key="AccessDB" value="d:\goldmine\orielgold\Goldmine.mdb">
ConnectionInfo crInfo = new ConnectionInfo();
crInfo.DatabaseName = appSettings.Settings["AccessDB"].Value;
crInfo.ServerName = appSettings.Settings["AccessDB"].Value;
crInfo.UserID = "";
crInfo.Password = "";
I need to do this now to a secured version. I have modified the above code to
ConnectionInfo crInfo = new ConnectionInfo();
crInfo.DatabaseName = appSettings.Settings["AccessDB"].Value;
crInfo.ServerName = appSettings.Settings["AccessDB"].Value;
crInfo.UserID = "Goldmine";
crInfo.Password = "orielgold";
BUT how do I specify the location/path/name of the system.mdw file?
In previous version there was a .add property but this does not appear in VS2005/CR XI R2 system.
Robert T Turner
|
|
|
|
|
I have a third part dll COM that communicates with my C# program through the interop.
I launch my program and it works correctly.
Then I attach some events that dll COM can fire. I do nothing in those events.
Now I launch my program and it leaks.
Is there a known bug firing events from COM to .NET or using interop?
Thanks in advance.
|
|
|
|
|
Hi All.
I'v got a problem with vertical scrolling in Win form DataGridView control.
I show about 40000 rows and make it by binding rows to a DataSet.
Some time the DataSet needs to be refilled from database and I run refilling function in a new thread. Then I initialize a datasource property with the new dataset. The datagridview shows my results but the vertical scrolling seems to be disabled. It doesn't react to my mouse clicks and even doesn't show a scroll on the scrilling bar. But if I do not use the thread everything works fine. Does anybody know a workaround? Please help.
Here is my code:
ThreadGetDataSource TGDS = new ThreadGetDataSource();
TGDS.Query = query;
TGDS.CallBack = SetDataSource;
Thread t = new Thread(new ThreadStart(TGDS.ThreadProc));
t.Start();
public void SetDataSource(DataSet DS) {
if (DS != null && DS.Tables.Count > 0)
this.dgView.DataSource = DS.Tables["Data"];
this.dgView.Refresh();
}
public delegate void SetDataSource(DataSet DS);
public class ThreadGetDataSource{
public SetDataSource CallBack;
public string Query = string.Empty;
public void ThreadProc() {
DataSet DS = GetData();
CallBack(DS);
}
public DataSet GetData (){
DataSet DS;
DataTransfer DT = new DataTransfer();
DS = DT.GetDataSet(this.Query, "Data");
return DS;
}
}
I tried to use methods Update, Refresh of the DataGridVew but it doesn't help.
Tried to call Refresh on DataBindingComplete event. Doesn't help either.
Thank you.
My best regards
|
|
|
|
|
|
hi,
i have problem in uploading bitmap files that is place at the mobile device-my document to server through either synchronize or GPRS using vb.net compact frame........
Please help me here...i will very appreciate if you can me....thanks.....
best regards
Jasmine
from Malaysia
|
|
|
|
|
i have cretaed an application using odbcConnection, when i m running this exe from the network it is showing odbcpermission error. plz can any body help me to solve this thru coding in vb .net?
i do not want to use manual setting thru .NET Framework wizard.
thanks and regards
kishore
|
|
|
|
|
|
Im trying to display information from a datbase using datagrid on the website but I keep getting the following error:
'ASP.customers_aspx does not contain a definition for 'SqlDataSource1_Selecting'
anyone know why???/
|
|
|
|
|
I would go back and review the code, the key part is 'does not contain a definition for sqlDataSource1_Selecting.
tim637
|
|
|
|
|
Hi friends,
Can anyone advice me how to post some html fields to a specific url (https) using .net and c#.
Thanks and Rgds
Nithin
|
|
|
|
|
You could firstly just sent the action of the form to the destination, which would be the easiest way. However, a while back I wrote a simple class which would allow you to post to a Url from code which is included below in case you find it useful
<br />
Public Class Poster<br />
<br />
#Region " Properties "<br />
<br />
Private values As New System.Collections.Specialized.NameValueCollection<br />
<br />
Private _postUrl As String<br />
Public Property PostUrl() As String<br />
Get<br />
Return _postUrl<br />
End Get<br />
Set(ByVal value As String)<br />
_postUrl = value<br />
End Set<br />
End Property<br />
<br />
Private _formName As String = "form1"<br />
Public Property FormName() As String<br />
Get<br />
Return _formName<br />
End Get<br />
Set(ByVal value As String)<br />
_formName = value<br />
End Set<br />
End Property<br />
<br />
Private _method As String = "POST"<br />
Public Property Method() As String<br />
Get<br />
Return _method<br />
End Get<br />
Set(ByVal value As String)<br />
_method = value<br />
End Set<br />
End Property<br />
<br />
Public Sub AddValue(ByVal name As String, ByVal value As String)<br />
values.Add(name, value)<br />
End Sub<br />
<br />
<br />
#End Region<br />
<br />
#Region " Publish Methods "<br />
Public Sub Post()<br />
If PostUrl Is Nothing Then Throw New Exception("No Url specified")<br />
If FormName Is Nothing Then Throw New Exception("No Form Name specified")<br />
If String.IsNullOrEmpty(Method) Then Throw New Exception("No method specified")<br />
'if values.Count=0 then throw new Exception("No post values supplied")<br />
<br />
HttpContext.Current.Response.Clear()<br />
HttpContext.Current.Response.Write("<HTML><HEAD>")<br />
HttpContext.Current.Response.Write(String.Format("</HEAD><BODY onload=""document.{0}.submit()"">", FormName))<br />
HttpContext.Current.Response.Write(String.Format("<form name=""{0}"" method=""{1}"" action=""{2}"" >", FormName, Method, PostUrl))<br />
For i As Integer = 0 To values.Count - 1<br />
System.Web.HttpContext.Current.Response.Write(String.Format("<input name=""{0}"" type=""hidden"" value=""{1}"">", values.Keys(i), values(values.Keys(i))))<br />
Next<br />
<br />
HttpContext.Current.Response.Write("</form>")<br />
HttpContext.Current.Response.Write("</body></html>")<br />
HttpContext.Current.Response.End()<br />
End Sub<br />
#End Region<br />
<br />
End Class<br />
|
|
|
|
|
pmic:
how i can understand that , which website(url) was opened in computer?
or
which website(url) is opene in computer now
thanks.
maysam_mici @yahoo.com
|
|
|
|