|
Try calling AnimateWindow from the constructor of Main_Form
[DllImport("user32.dll")]
static extern bool AnimateWindow(IntPtr hwnd, uint dwTime, uint dwFlags);
enum AnimateWindowFlags : uint
{
AW_HOR_POSITIVE = 0x00000001,
AW_HOR_NEGATIVE = 0x00000002,
AW_VER_POSITIVE = 0x00000004,
AW_VER_NEGATIVE = 0x00000008,
AW_CENTER = 0x00000010,
AW_HIDE = 0x00010000,
AW_ACTIVATE = 0x00020000,
AW_SLIDE = 0x00040000,
AW_BLEND = 0x00080000
}
public Main_Form ()
{
...
AnimateWindow(this.Handle, 250, (uint)AnimateWindowFlags.AW_VER_NEGATIVE | (uint)AnimateWindowFlags.AW_CENTER);
...
}
|
|
|
|
|
That works, but only if I put it before InitializeComponent();
Which makes it animate but the form doesn’t start in the proper position because InitializeComponent(); hasn't been called yet
It's not that big of a deal anyway. Just weird that it would work and then decide not to Probably something I did
Thanks anyway,
Sean
|
|
|
|
|
That is weird.
For me, it works both before and after InitializeComponent();
To get around it not starting in the proper position (at least in .net 2.0) you can do something like this:
public Form1()
{
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
AnimateWindow(this.Handle, 250, (uint)AnimateWindowFlags.AW_VER_NEGATIVE | (uint)AnimateWindowFlags.AW_CENTER);
InitializeComponent();
}
|
|
|
|
|
I am using RegEx to find a section of a html document. The document can change, but the format is always the same.
I need RegEx to pull out:
>Name:VisualStudio
Then pull out VisualStudio (VisualStudio is a part of the page that may change)
Is there a way I can do this by passing strings to a function?
Thanks for any, and all help!
|
|
|
|
|
Let's have a look at your code, then, and perhaps you can tell what's the problem with it?
---
b { font-weight: normal; }
|
|
|
|
|
I don't have any code yet as I haven't ever worked with RegEx. I have heard it is difficult, i want to learn but I don't even know the structure.
|
|
|
|
|
private static void InterpretData(string szProfile)
{
Regex rxFind = new Regex(@">Name <szcharname>)");
MatchCollection matches = rxFind.Matches(szProfile);
foreach (Match match in matches)
{
if (match.Length != 0)
{
Console.WriteLine("Character Name: {0}", match.Groups["szcharname"]);
}
}
Console.WriteLine("RegEx'ed'");
Console.ReadLine();
}
It isn't finding a match. See anything?
I think that matches assumes you know exaclty the formet of the string. How do I FIND the string, then match it? Is there a better way?
-- modified at 20:30 Tuesday 7th February, 2006
|
|
|
|
|
You have specified that you want to find a question mark. That will match exactly one occurance of that character, nothing else.
Use a period to match any character (except line break), use a plus sign to specify that it should occur one or more times, and add a question mark after the plus sign to specify that it should match as few times as possible.
Regex rxFind = new Regex(@">Name:</td><td>(.+?)</td>");
---
b { font-weight: normal; }
|
|
|
|
|
I need to find the data between where the ? was. How do I do that?
|
|
|
|
|
string text="";
Regex x = new Regex(">Name:</td><td>(.+?)</td>");
foreach (Match m in x.Matches(text))
{
if (m.Groups.Count > 1)
{
Console.WriteLine(m.Groups[1].Value);
}
}
|
|
|
|
|
string text = szText;
//Get text here
//Parse
Regex x = new Regex(">Name lt;charactername>)");
foreach (Match match in x.Matches(text))
{
if (match.Length != 0)
{
Console.WriteLine("Hello: {0}", match.Groups["charactername"]);
}
}
Console.WriteLine("RegEx'ed'");
Its not working!
|
|
|
|
|
Ok, I am pulling a page off the internet. I want to first grab this out of the HTML:
>Name:Whatcha
Then grab Whatcha out of that.
I will not know that the name will be Whatcha everytime, nor will i know the length. It will always be a string, and in the same spot.
Help please. I don't know how to do this at all. I learn by example. Thanks for your time.
|
|
|
|
|
Ok my problem lies in this:
Regex rxFind = new Regex(">Name <szchar>)", RegexOptions.IgnoreCase);
It has something to do with the (?<szchar>), how do I properly format this so that I can get whatever information is there?
|
|
|
|
|
I already answered this. There is no use to rephrase the question over and over if you never read the answers.
---
b { font-weight: normal; }
|
|
|
|
|
No, I read your response. You were wrong. ? starts the query. I forgot to include what I was looking for. The correct statement is this:
Regex rxFind = new Regex(">Name <szchar>[a-z]+)", RegexOptions.IgnoreCase);
I forgot to say I was looking for an alphanumeric word ([a-z]+).
|
|
|
|
|
for alphanumeric your [a-z] should probably have been [A-Za-z0-9]
|
|
|
|
|
So you want to find a string that starts with a question mark? Like ">Name:</td><td>?Jane</td>"?
---
b { font-weight: normal; }
|
|
|
|
|
Hi I try to create a makecert like program in order to generate X.509 certificates (which extends PKCS6).
So is there any open source version or any source code that might help?
Thanks
|
|
|
|
|
How can I extract a dataset to an Excel Spread Sheet?
|
|
|
|
|
Hi everybody,
I'm trying to develop an application that will send some type of alert(text message) to a cell phone when a certain event occurs. Where do I start? Where can I find more information on doing this? I'm using C# in MS VS.NET 2003
|
|
|
|
|
|
hi i want to set property of controls in one form from other forms and i test all ways (for example public modefiers,define property that return control.property , ...) and don't gave result .
please help me ...
|
|
|
|
|
set the modifiers on textbox1 to public.
if this doesn't fix the problem, post the code you are using.
|
|
|
|
|
hi thanks to your instruction but don't get result for change textbox1 modefier to public . here is my code :
//in form 1 (modifier of textbox1 is public):
this.textbox1.text = "hello";
//in form 2 (for example):
Form 1 f = new Form1();
//this line should be display Form1.textbox1.text in Form2.label1.text but doesn't it :
this.label1.text = f.textbox1.text;
|
|
|
|
|
this.textbox1.Text = "hello"; needs to be in the constructor of Form1, otherwise textbox1.text will contain the default value "" (nothing) until it is assigned to. Also, the textbox needs to be initialized before this happens.
You might also try telling the label to redraw itself after its text value gets reassigned: this.label1.Invalidate();
public System.Windows.Forms.TextBox textbox1;
public Form1()
{
this.textbox1 = new System.Windows.Forms.TextBox();
...
this.textbox1.Text = "hello";
}
Form1 f = new Form1();
this.label1.Text = f.textbox1.Text;
this.label1.Invalidate();
To see if things are working, you can try this:
public System.Windows.Forms.TextBox textbox1;
public Form1()
{
this.textbox1 = new System.Windows.Forms.TextBox();
...
}
Form1 f = new Form1();
f.textbox1.Text="hello"
this.label1.Text = f.textbox1.Text;
this.label1.Invalidate();
|
|
|
|