|
You shouldn't instantiate and add that TextBox with each iteration of your loop! Talk about sucking up system resources. Instantiate it once in the first method, then pass a reference to it in the recursive method.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
I only create the TextBox if the current control has focus and causes validation events. It is not for every control, only when I find the focused one. And once I find it, I immediately return and the loop stops. I believe that TextBox is created only once every time I call the main ValidateFocusedControl routine.
And still I only force validation when the Save button is clicked on the toolbar, so that's once or twice in the life of the form.
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
|
|
|
|
|
Hello,
I have a MDI application, with several types of MDI children. When I get a ButtonClick event from the toolbar in the main form, I want to determine the active MDI child, so I can react appropiately.
I have some code that looks like this:
void ToolBar_OnButtonClick()
{
foreach(Form form in this.MdiChildren)
{
if(form.Focused && form.WindowState != Minimized)
{
if(form is FormType1)
MessageBox.Show("form type 1 active");
else if(form is FormType2)
MessageBox.Show("form type 2 active");
}
}
}
I would expect a messagebox telling me the type of the active form when I click a button on the toolbar, but nothing happens. Any ideas?
-- LuisR
___________
Luis Alonso Ramos
Chihuahua, Mexico
www.luisalonsoramos.com
|
|
|
|
|
See ActiveMdiChild property.
For more information see: MSDN[^]
This posting is provided "AS IS" with no warranties, and confers no rights.
Alex Korchemniy
|
|
|
|
|
Alex Korchemniy wrote:
See ActiveMdiChild property
Exactly what I need. Actually I looked for something named like MdiActiveChild or MdiChildren.ActiveForm before posting this message. I just missed the exact wording.
Thanks!
-- LuisR
___________
Luis Alonso Ramos
Chihuahua, Mexico
www.luisalonsoramos.com
|
|
|
|
|
Hello,
I have a dataTable in my database with columns title, category, problem(description of the problem) and solution. I want to develop a good search mechanism for certain problems so that the user can search for problems – solutions, when he quotes a search term. But I think it is not a good search mechanism when the specific problem with solution is only displayed when the user quotes the correct title of the problem. Is there any other possibility, which is not so difficult to implement?
Regards
mat
|
|
|
|
|
This is more of a database thing. You're going to have more luck asking in the SQL / ADO / ADO.Net Forum [^]
It boils down to how you query the database. SQL is where you need to solve the problem. Moving data into C# and using ADO.NET is not the way to go.
This posting is provided "AS IS" with no warranties, and confers no rights.
Alex Korchemniy
|
|
|
|
|
I think I can make it with Full Text Search. Does anbody know how the SQL Query String should look like, when I want to retrieve all titles of the dataTable when the quoted search term occurs in the title or the problem description or the solution?
As said my columns are
Title
Category
Problem
Solution
Regards
|
|
|
|
|
The syntac for FREETEXT is as follows:
FREETEXT ( { column | * }, 'freetext_string' )
Where
- Column is a full-text index-enabled column, to which the search is directed.
- * specifies that all columns are enabled for full-text search and that the search is directed to these columns
- 'freetext_string' specifies the search criteria. This has to be data of type char, varchar, nchar, nvarchar, or any other character data.
An example:
USE Pubs
GO
SELECT pr_info
FROM pub_info
WHERE FREETEXT (pr_info, 'PuBLiShInG')
This posting is provided "AS IS" with no warranties, and confers no rights.
Alex Korchemniy
|
|
|
|
|
But I use SQL Server 2000 and there I find no menu point FUll Text Search enable. What can I do in that case?
|
|
|
|
|
I have just read that the SQL Server CE does not support Full Text Search. Is there any other possibilty to get such an mechanism??
|
|
|
|
|
|
String s = "Lorem ipsum dolor sit amet, kec=123abc";<br />
int index = s.IndexOf("kec=");
You can then use SubString method to extract what you need.
This posting is provided "AS IS" with no warranties, and confers no rights.
Alex Korchemniy
|
|
|
|
|
Ok, this is fairly simple, i need to find/make a text control
that behaves much like a dos box except, i cant use the console because i want to be able
to use graphics (images, controls, etc) also within this space... how would i do this?
any ideas much appriciated
_O
|
|
|
|
|
RichTextBox is the way to start. Then you need to find a way of getting the console part of it to work.
This posting is provided "AS IS" with no warranties, and confers no rights.
Alex Korchemniy
|
|
|
|
|
|
hi all, i need to plot a line chart. i plot my graph in a rectangle. im using this method:
Rectangle myRect1 = new Rectangle (105,115,644,375);<br />
myGraphics.TranslateTransform(105,490);
for (drawLineIndex1=0; drawLineIndex1<9; drawLineIndex1++)<br />
{ <br />
for (index1=0; index1<10; index1++)<br />
{<br />
ptf[index1] =new PointF(105,(-375/maxValue)* -2.3); <br />
}<br />
}
myGraphics.DrawLine(myPen, ptf[drawLineIndex1], ptf[drawLineIndex1+1]);
however, this method only works for +ve perfectly. but for -ve value i can't fit the -ve points within the range of my rectangle . Is there any other way to plot a line chart for -ve and +ve values?
Chris
|
|
|
|
|
Hi Chris,
Sorry I can't help you, but i want some help from u. I am also working on the same type of problem. But i am having values between 0 and some positive value (say 0 - 480000). I want to plot Line-Column chart for my data, as u see in an histogram of an image. Now how can i plot a 2D- graph for this. Using the same lines of code tht u have written. Meanwhile I will figure it out myself. But, if u can gimme some advice, plz.
thanks in advance,
Suman
|
|
|
|
|
the simplified coding is :
<br />
for (index1=0; index1<10; index1++)<br />
{<br />
ptf[index1] =new PointF(105 + 28,250);
}<br />
}<br />
myGraphics.DrawLine(myPen, ptf[drawLineIndex1], ptf[drawLineIndex1+1]);
i hope this help.
Chris
|
|
|
|
|
Hi,
i can understand ur code... but the problem is...
I have developed a Windows form Project in C# and in tht i am opening different bitmap images....now in tht when a bitmap is active and the user selects a menu button "Histogram"... i have to display the histogram of tht image in a seperate window.
Hope i am clear now... if u have any ideas plz share with me...
thanks,
Suman
|
|
|
|
|
Chris wrote:
for (index1=0; index1<10; index1++)<br />
{<br />
ptf[index1] =new PointF(105,(-375/maxValue)* -2.3);<br />
}
Please clearify. The above code is supposed to be generating your points right? It doesn't accomplish anything since its always going to be the same PointF .
Another thing GDI drawing starts with the top left corner and goes down and right across. So you have to flip on the Y axis. Once you get the Point[] you can call DrawPolygon .
This posting is provided "AS IS" with no warranties, and confers no rights.
Alex Korchemniy
|
|
|
|
|
Hello,
Iam new to c#
My Problem is something like this.
Create a sample windows application, having 2 textboxes & a command
button
Set the forms controlbox property to True
Write validation event for the textbox
private void txtpassword_Validating(object sender,System.ComponentModel.CancelEventArgs e)
if (txtempno.Text=="")
{
MessageBox.Show("Please Enter User Id and password","Invalid Data",MessageBoxButtons.OKCancel);
e.Cancel = true;
}
while running the application when the user clicks the button1
even button1 causes validation set false
the focus is still in of the textbox,
the validation event of the textbox still fire.
Same is the case when the user clicks the [X] button on the control box.
i.e validation event is fired and form is not closed
Form Causesvalidation property aslo set flase.
if i write the code in the Form1_closing event then also the problem is not being solved.
This is because the validation event of the textboxes is fired first so the execution never reaches the Form1_closing event.
How can i close my Form when user user click [X] button on the control box.
or button1??????????????????
|
|
|
|
|
You can override the form close event. and can give your own event handler. So what you can do is ,set e.Cancel=false inside the overrided handler.
eg:
<br />
protected override void OnClosing(CancelEventArgs e)<br />
{<br />
try<br />
{<br />
if(MessageBox.Show("This Will Close Your Form . Do You Want To Continue ?","Conformation",MessageBoxButtons.YesNo,MessageBoxIcon.Information) == DialogResult.No)<br />
{<br />
e.Cancel = true;<br />
base.OnClosing (e);<br />
}<br />
else<br />
{<br />
this.Dispose();<br />
<br />
}<br />
}<br />
catch(Exception Ex)<br />
{<br />
MessageBox.Show("Ex.Message.ToString(),"Information",MessageBoxButtons.OK,MessageBoxIcon.Information);<br />
<br />
}<br />
}<br />
Sreejith Nair
[ My Articles ]
|
|
|
|
|
It works but validate event fires first before closing event ? again message displays that "please enter user id and pass word".............? after this closing
How can i handle this event in button click???
|
|
|
|
|
Im trying to crontrol a Buttons Visablity on the main Form1..
I've searched all over the internet for help on this subject and couldnt find any soo I will post my question here
My Code:
if (blargh == verc)
{
Form1 f = new Form1();
f.btn_Start.Visible = true;
f.btn_Patcher.Visible = false;
}
else
{
Form1 f = new Form1();
f.btn_Start.Visible = false;
f.btn_Patcher.Visible = true;
}
}
|
|
|
|