|
You can still do your tasks in a separate thread...I don't think he was suggesting that you create multiple threads for each block of code. Create one, let it do all of your tasks, just as your button event handler would have. At least this way you'll have control of your window.
How long is your applications "hanging"? If it never stops hanging, then it's not an issue with overload, there's something in your code that is causing the application to hang. Step through it line by line to see exactly what is going on.
|
|
|
|
|
How could i design two windows forms(Parent & child) like in MSword that the maximum size of the child form does not exceed the max size of the parent form and when maxmizing the child form its control cox still appeare below the control box of the parent form ?
|
|
|
|
|
ImanMahmoud wrote:
How could i design two windows forms(Parent & child) like in MSword that the maximum size of the child form does not exceed the max size of the parent form and when maxmizing the child form its control cox still appeare below the control box of the parent form?
Could it be that you want to create an application with a Multiple Document Interface[^] (MDI)? If so, check out Multiple-Document Interface (MDI) Applications[^] on MSDN.
Best regards
Dennis
|
|
|
|
|
easy,in the properties inspector for the main form, set the "IsMdiContainer" property to true. then create a new form and call it Form2 (the default value, used for the sake of this example) in the load event of the first form (Form1), paste this code.
Form2 Form2 = new Form2();
Form2.MdiParent = this;
Form2.Show();
the Form2 now cannot escape the parent, which is an Mdi, or multiple document interface form.
|
|
|
|
|
hi, I'm making a simple html editor, and in order for it to be actually somewhat useful, I need to color code the text within the <> characters. I've gone through the regular expression tutorial, (which was written very well by the way), and I have a question. How do I change the color of the text that the expression finds. the text I want to change is in a richTextBox1. also, without forgetting the previous question, how do I make an event handler for when to color code these things. I would do it on text change, but that really doesn't work well cause it eats up a lot of memory, and makes the program flicker. atleast I think it does. any help is very very appreciated.
|
|
|
|
|
I am not able to pass values between forms. The main form calls a custom dialog that offeres options. On click, the form sets the string variable that needs to be read by the form. Once you get back to the first form, that string is not able to be read.
Here is the code from form1:
<br />
public class MainParent : System.Windows.Forms.Form<br />
{<br />
public string fromForm2; <br />
<br />
public MainParent()<br />
{<br />
InitializeComponent();<br />
}<br />
static void Main() <br />
{<br />
Application.Run(new MainParent());<br />
}<br />
<br />
private void MainParent_Load(object sender, System.EventArgs e)<br />
{<br />
GetFormTwoData();<br />
}<br />
<br />
public void GetFormTwoData()<br />
{<br />
Form myForm2 = new Form2();
myForm2.Owner = this;<br />
myForm2.ShowDialog();<br />
<br />
}<br />
<br />
ok... here is form 2
<br />
public class Form2 : System.Windows.Forms.Form<br />
{<br />
private System.Windows.Forms.Button button1;<br />
string controllerName = "";<br />
<br />
private System.ComponentModel.Container components = null;<br />
<br />
public Form2()<br />
{<br />
<br />
InitializeComponent();<br />
<br />
}<br />
public string ControllerName<br />
{<br />
get<br />
{<br />
return controllerName;<br />
}<br />
set<br />
{<br />
controllerName = value;<br />
}<br />
}<br />
<br />
#region Windows Form Designer generated code<br />
<br />
<br />
public void button1_Click(object sender, System.EventArgs e)<br />
{<br />
<br />
ControllerName = "UtilitySaver";<br />
this.Hide();<br />
}<br />
<br />
}<br />
}<br />
OK... so when form 1 calls form 2 and user clicks button, the fromForm2String needs to match the ControllerName from Form 2???
Sorry if this does not make sense. I am a tru newbi, but not afraid of the work and so VERY wanting to learn...
Thanks in advance.
|
|
|
|
|
Hi,
I was trying to look into your code?? Where is "fromForm2String" in the code.
Button is on Form2, right. What should happen when one clicks on the button on form2. Please expalin a little more of this.
|
|
|
|
|
Had this nice long reply, and the problem was answered.... Thank you so much for your time anyway.
-dgb
|
|
|
|
|
Your code is fixed quite easily:
First of all, you're creating an instance of Form2 . Then why do you store it in a variable of type Form ? I guess the line should read:
Form2 myForm2 = new Form2();
That way you can access myForm2 's property ControllerName . Form doesn't have such a property, your derived class has.
Second, after the button has been clicked you're just making myForm2 invisible (this.Hide() ). Unless you're actually closing the form, your first form will remain in myForm2.ShowDialog() . So I'd suggest you replace this.Hide() with this.Close() .
Regards,
mav
|
|
|
|
|
OK. I will check tomorrow if that works. I assume it does. I thought you had to ref the Form... not sure why (I was adapting some code from a book). It makes total sense to ref the Form2 myForm2 = new Form2();
Thanks so much.
|
|
|
|
|
This worked perfect. Thanks so much.
|
|
|
|
|
As you are using an OleDbDataReader you cannot do this directly. You can keep a count as you are reading the records from the DataReader - which is useful if you don't need to know until you have finished reading.
However, if you need to know before reading information from the reader then you need an extra bit of SQL.
You should really do the following in a stored procedure (If your database supports it) and use a try/catch block, but for brevity I'll just do it directly.
OleDbCommand cmd = OleDbCommand("SELECT COUNT(*) FROM MyTable;SELECT * FROM MyTable",
MyConnection);
MyConnection.Open();
OleDbDataReader reader = cmd.ExecuteReader();
reader.Read();
int numRows = reader.GetInt(0);
reader.NextResult();
while(reader.Read())
{
}
reader.Close();
MyConnection.Close();
* Disclaimer: I typed everything directly, there may be some errors
Do you want to know more?
WDevs.com - Open Source Code Hosting, Blogs, FTP, Mail and Forums Upcoming talk:
SELECT UserName, Password FROM Users
-- Getting unauthorised access to a SQL Server, and how to prevent it.
|
|
|
|
|
hi
when i update my webreference(localhost) of client application,
my Microsoft.VSDesigner doesnt generate code for
"Reference.cs" file and i must fill it manually.
what should i do???
|
|
|
|
|
it is a static designer.I had the same problems , and I did the same things, that you've done.
But the fact is , Reference.cs is a cs file , so you may code into it , I dont know what you update , so the programming will have a border , if you change the whole service , it is impossible , I guess..But for example , it is about IP , you may re-code the file..
Anyways if you find a exact solutions , please let me know..
Bahadir
|
|
|
|
|
WDI,
If you are modifying the web service project that you've added a web reference to, then you can make VS update Reference.cs by right-clicking the web reference and choosing the update option. You'll need to rebuild and/or re-deploy the web service after you change it and before you do this, of course.
If you're writing a designer for a custom control, then give us some more details because I'm not sure what you're trying to accomplish or what the problem is.
PatrickShane
Microsoft Web Services Team
|
|
|
|
|
hi
it is obvious that i update reference by rightClick the webReference, rebuild webservice,client and any things i thought
and i didnt wrote a designer .
|
|
|
|
|
WDI, I'm responding to your e-mail back in the forum.
WDI wrote:
Hi
this is exact problem.
when i add webmethod to webservice and build it and update
client webreference, client knows the new webmethod without any problem.
but when i add a new class to webservice project and build it and update client webreference, client doesnt know the new class.
Note:this is a new problem and a few days ago when i added
a new class to webservice client could knows new class.
this problem is for new solutions too.
If you added a new web service class by putting it into a new ASMX file, then that's a separate web reference. You'll need to add it to the client project as a new web reference.
If you added a new web service class to the existing ASMX file, then it won't be visible to the world. You can only have one web service class in each ASMX file. Your project will still build if you do this, but only the first class will be exposed in the WSDL.
Hope this helps,
PatrickShane
|
|
|
|
|
Hi
no the class is a .cs file and not an ASMX file.
what should i do plz?
|
|
|
|
|
I am trying to figure out how to send emails through an exchange server but all I can find is information on how to send emails through SMTP servers. I heard whispers and hints that I should be using CDO but i don't really see any documentation on how to use exchange servers.
Suggestions anyone?
Thanks!
Jim
|
|
|
|
|
Ah, I finally found MAPI documentation but its in a different threading apartment then the stuff that I was previously doing! I need to be in a MTA for the code I am writing, so what do I do?
Cheers,
Jim
|
|
|
|
|
Hi,
I have an app in which I a render a number of DirectDraw surfaces on the screen. I want to capture this as a movie that I can play in PowerPoint. Please help me on this. I don't want to save the DDraw surfaces as jpg images and then create a movie using something like premiere bcos the images take up so much disk space.
sid
|
|
|
|
|
Hi
I've got this line:
<br />
Vector2* test = UnsafeNativeMethods.Vector2.Hermite(pOut, pPos, pTan, pPos2, pTan2, weight);
which should work I think, but it says:
The type or namespace name 'UnsafeNativeMethods' does not exist in the namespace 'Microsoft.DirectX' (are you missing an assembly reference?) C:\DXDev\CodeFile1.cs
I've loaded the microsoft.directx.dll version 1.0.900.0
Whats happening??
Thanks
|
|
|
|
|
It should work... I have a newer version though.
public static unsafe Vector2* Hermite(Vector2* pOut, Vector2* pPosition, Vector2* pTangent, Vector2* pPosition2, Vector2* pTangent2, float weightingFactor);
Declaring Type: Microsoft.DirectX.UnsafeNativeMethods+Vector2
Assembly: Microsoft.DirectX, Version=1.0.2902.0
top secret Download xacc-ide 0.0.3 now! See some screenshots
|
|
|
|
|
This is about generating monochrome image from JPEG 24BPPRGB by dropping out background colors and making rest as black in GDI+...I have few shades of RGB values(specifying dropped out color).
I am developing Winform application which processes the scanned image then does the OCR on it, before that It needs to perform Color dropout on scanned image i.e. removing the background color of image so it won't interfere with the textual characters.....Color to be droppped out is specified by the user (they are the diffrent shades not the primary colors)..In addition I also wish to explore thresold function to select Pencil shades..Pls post the link if u find it would serve the purpose.
Any help regarding this would greatly be apprciated
regards.
MaulikCE
|
|
|
|
|
Why is it that an event, defined in a base class, can only be called from that class, and can't be called from a derived class?
Marc
MyXaml
Advanced Unit Testing
YAPO
|
|
|
|