|
|
Back ward Compatibility is always Possible
"Aim to go where U have never been B4 and Strive to achieve it"
http://groups.yahoo.com/subscribe/dotnetforfreshers
http://himabinduvejella.blogspot.com
|
|
|
|
|
Hi
Is there any way to update configration files at runtime (first run) ?
I using data application block in asp.net, a setup page get database setting
from user and need to save in engrypted configration file.
Sorry for my bad inglish !
So Thanks
|
|
|
|
|
how can i access a shared folder in a server?, that have a exclusive user access in windows forms with other user.
My app request the user's username and password, then with Windowsidentity and logon with shell32 obtain the authentificacition on the domain, but when i impersonate with that user, all the system.io methods don't use the identity, when they try to connect the ioexception is raised, because don't have the permissions to access.
I already try to using net use and the mpr.dll functions,but the user have already other shared folder mapped in drives.
-- modified at 16:23 Saturday 29th April, 2006
|
|
|
|
|
can anyone duplicate MSN explorer with embedded chat system in the left pane?
Thanks in Advance!!!
|
|
|
|
|
What's your question? Noone here is going to write an application for you.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hi dave,
i dont need the application. i just want to learn how the custom components are designed and and implemented.i've tried lots of skinning component, iam not able to build/replicate MSN explorer.kindly help in this regard .
Thanks in Advance!!!
|
|
|
|
|
You never specified any of this in your original post...
The processes and methodologies behind custom controls can take up entire books. I would start with a little Googling, like for "writing custom controls vb.net"[^]. Or change the language to whatever you're using.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
If you create all your business logic inside of a class which does a bunch of processing. Let's say this class is passed a file name and reads each line of the file to do some processing. If I want to display to the user the progress of reading through the file, what is the best way to update the progress bar?
How do you keep business logic and presentaion layer separate in this case?
Mike
|
|
|
|
|
You make a new event (ReadStautsUpdate for example) and then your class fiers that event everytime it reads a line.
You add a event hanlder on your form which will update the progressbar.
--------------------------------------------------------
My development blog
Q:What does the derived class in C# tell to it's parent?
A:All your base are belong to us!
|
|
|
|
|
If your business logic runs on an other machine than your client you have to use i.e. something like the massage queue server, which provides the notification of your client of server side events.
regards, bernd
|
|
|
|
|
Does anyone know how to match the look of a ToolStripButton's "Checked" state? I've had to replace a couple of ToolStripButtons in my UI with ToolStripSplitButtons, but the SplitButtons don't have a "Checked" property.
So, I made my own ToolStripSplitButton with a Checked Property, but I cannot figure out how to match the way the ToolStripButton randers the "Checked" state. Here's what I've tried:
<br />
public class ToolStripSplitButtonEx : ToolStripSplitButton<br />
{<br />
private bool _Checked = false;<br />
private VisualStyleRenderer renderer = null;<br />
private readonly VisualStyleElement element = VisualStyleElement.ToolBar.Button.Checked;<br />
public ToolStripSplitButtonEx()<br />
{<br />
<br />
<br />
if (Application.RenderWithVisualStyles &&<br />
VisualStyleRenderer.IsElementDefined(element))<br />
{<br />
renderer = new VisualStyleRenderer(element);<br />
} <br />
}<br />
public bool Checked<br />
{<br />
get<br />
{<br />
return _Checked;<br />
}<br />
set<br />
{<br />
_Checked = value;<br />
this.Invalidate();<br />
}<br />
}<br />
<br />
<br />
protected override void OnPaint(PaintEventArgs e)<br />
{<br />
base.OnPaint(e);<br />
if (_Checked)<br />
{<br />
renderer.DrawBackground(e.Graphics, this.Bounds);<br />
}<br />
}<br />
}<br />
This doesn't seem to do anything at all. I'd originally been simply drawing a rectangle that was the proper color, but that doesn't work with different XP themes. Does anyone know about how to tackle this?
|
|
|
|
|
I've updated my OnPaint function to the following:
<br />
protected override void OnPaint(PaintEventArgs e)<br />
{<br />
if (_Checked)<br />
{<br />
if (renderer != null)<br />
{<br />
System.Drawing.Rectangle cr = base.ContentRectangle;<br />
System.Drawing.Image img = this.Image;<br />
<br />
int centerY = (cr.Height - img.Height) / 2;<br />
<br />
System.Drawing.Rectangle fullRect = new System.Drawing.Rectangle(0, 0, this.Width, this.Height);<br />
<br />
System.Drawing.Rectangle imageRect = new System.Drawing.Rectangle(<br />
base.ContentRectangle.Left,<br />
centerY,<br />
base.Image.Width,<br />
base.Image.Height);<br />
<br />
System.Drawing.Rectangle textRect = new System.Drawing.Rectangle(<br />
imageRect.Width,<br />
base.ContentRectangle.Top,<br />
base.ContentRectangle.Width - (imageRect.Width + 10),<br />
base.ContentRectangle.Height);<br />
<br />
renderer.DrawBackground(e.Graphics, fullRect);<br />
renderer.DrawText(e.Graphics, textRect, this.Text);<br />
renderer.DrawImage(e.Graphics, imageRect, this.Image);<br />
}<br />
else<br />
{<br />
e.Graphics.FillRectangle(System.Drawing.SystemBrushes.Control, 0, 0, this.Width, this.Height);<br />
e.Graphics.DrawRectangle(new System.Drawing.Pen(System.Drawing.SystemColors.Highlight), 0, 0, this.Width - 1, this.Height - 1);<br />
base.OnPaint(e);<br />
}<br />
}<br />
else<br />
{<br />
base.OnPaint(e);<br />
}<br />
<br />
}<br />
Now I've got the image and text, but nothing looks right. I thought that setting the renderer to be the same as a checked button would fix this, but the font is wrong and the background appears blank.
Am I going about this the wrong way?
|
|
|
|
|
hey @ all,
does anyone of you have experience by implementing the mvc-pattern? implementing the model should not be the problem, but how should i design the view (respectifly the fassade) when i try to build a app, that serves the model to the client's by remoting. i try to make a client-server-app, where the inelligent part of the app runs on the server an all clients are running just a proxy of the application. does this make sense? or ist there an other, better way to implement the mvc-pattern?
thx, bernd
|
|
|
|
|
As far as I know MVC is used in web applications and not windows applications. Bu please correct me if I am wrong.
--------------------------------------------------------
My development blog
Q:What does the derived class in C# tell to it's parent?
A:All your base are belong to us!
|
|
|
|
|
MVC is used in windows apps as well as web apps.
|
|
|
|
|
My bad then
--------------------------------------------------------
My development blog
Q:What does the derived class in C# tell to it's parent?
A:All your base are belong to us!
|
|
|
|
|
ok, and how do i implement it the correct way? is there anywhere a guide for doing this in any other language? i just know what components are used in mvc and i tryed to implement it by using web-sservices to build something like a fassade for my app, but it seems to be not the right way. in fact i'm not sure if something like a fassade is the right way because it provides just a one way communication.
please give me some hints.
regards, bernd
|
|
|
|
|
It's difficult to answer that question because the number of unknowns is far too high. The only advice I can give is to make sure that using the MVC pattern is actually necessary, so that you don't rip your hair out over it unnecessarily.
This is not a criticism of you, of course, but I find that many developers use design patterns just for the sake of using them. Almost habitually. In my view, patterns should only be used when they help solve a problem. In general design patterns add unnecessary complexity to, what should be, simple solutions.
Josh
|
|
|
|
|
if we r using component in our application, how can we handle exception raised in a component?
|
|
|
|
|
Just like any other exception.
--------------------------------------------------------
My development blog
Q:What does the derived class in C# tell to it's parent?
A:All your base are belong to us!
|
|
|
|
|
If any of your code is in the call stack when the exception is thrown, you can handle the exception at the call site which eventually triggers the exception to be thrown. If your code is not in the call stack, then you should get the component developers to fix the bug asap.
If you are working in WinForms, perhaps hooking the Application.ThreadException event could be useful for you as well. That event fires when an exception on the UI thread is not handled and is about to crash the app.
Josh
|
|
|
|
|
I have a regular expression that I use to find html tags in a string, the expression is similar to the following:
<(?<TagName>[a-zA-Z\d]{1,})(\s[a-zA-Z\d]{1,}="[\s\w]{0,}"){0,}(\s/>|\s?>.*?</\k<TagName>>)
It's designed to detect html tags such as the following:
<strong /> OR <strong>Text</strong> OR <strong ID="supertext">Text</strong>
What I'd like to do is use this expression to split a file into an array of strings but I get odd results when I use the Regex.Split() method.
Lets say I want to split the following line of text:
The <em>quick</em> brown fox jumps over the <strong>lazy</strong> dog.<br />
Regex.Split() produces the following array:
1 - The
2 - <em>quick</em>
3 - >quick</em>
4 - em
5 - brown fox jumps over the
6 - <strong>lazy</strong>
7 - >lazy</strong>
8 - strong
9 - dog.
10 - <br />
11 - />
12 - br
It's obviously splitting on the sub groups as well as the entire tag.
Is there any way I can tell the regex engine to only split 1 group, not them all?
As you can see the solution isn't as simple as just removing the extra groupings because they are needed so that I can detect the close of an open tag, and allow more than one property to be in each html tag.
Thanks in advance for any help
|
|
|
|
|
If you need a non-catching group, use (?:
---
b { font-weight: normal; }
|
|
|
|
|
Thank you for the answer, that helped a LOT.
I've ALMOST eliminated all of the excess data, except for one thing:
The only other drama that I am facing now is that I can't apply the non matching group to the named capture group called "TagName" which I unfortunatley need to recognise the closing tag.
Is there any way that I can use a named capture group ONLY inside the regular expression, just for the purposes of matching the closing tag?
|
|
|
|