|
Hello, everybody!
I have a little problem with a form... i have a datagrid binded to a database. i added one buttoncolumn called delete. What is the event to call when the delete button is clicked? or how do i know when the button is pressed? i've found no suitable events for the datagrid.
Thanx a lot!
|
|
|
|
|
How can I resize a panel according to form size?
I have the ff code:
this.pnlGrndWv.Size = new System.Drawing.Size(this.Size.Width,this.Size.Height);
This worked but what I actually wanted was to capture the size of form(with the excess page which i can view using scrollbar), I mean I want to know the size of the "long" windows form, I want to actually simulate ng Panel size to "real" form size. How can I do this? Thanks!
|
|
|
|
|
Use this :
this.pnlGrndWv.Dock = System.Windows.Forms.DockStyle.Fill;
|
|
|
|
|
|
Good day everyone,
I need to design and implement a Class Library project for the Heap data structure.
Is there anyone know where I can have a reference or a sample project?
If you're interested in, pls help.
Thanks so much.
eric
|
|
|
|
|
|
I've created a custom control that uses ControlStyle.BackBuffer ControlStyle.User etc...
And i show a marquette when i move the mouse.
the problem is if i use ControlStyle flags the control doesn't flicker but the it is impossible to see the marquette, if i doesn't use ControlStyle flags the marquette is showed correctly an it follow the mouse but the control flicks.
Whow can i avoid the flickering drawing also the marquette?
|
|
|
|
|
I assume you are using CreateGraphics to obtain a Grpahics object to draw your marquette to. You should in this case instead fill some field with the info on where to draw the marquette and call Invalidate to initiate a complete redraw of the control. Than in OnPaint you can also draw the marquette.
If this is too slow because the painting function is very complex you will have to paint into a bitmap first and then draw this onto the control. While only the marquette is changing you could always just draw the bitmap + marquette.
|
|
|
|
|
hi all, i have checkbox on header template of each datagrid column and i want to know which check box is checked and according to that checkbox i want to load data on to another grid.to find that checkbox i use OnItemDatabound but it find only at the pageload,at the same time OnItemDatabound event get fired when the databind() method called but it didn't find that checkbox( even it is checked..)is there any way to solve this prob....?
ayyp
|
|
|
|
|
Hi,
I'm using rtf syntax to create link in richtext box in C# windows application. My problem is I cannot change the link color. My code is as follows:
string clrTable = "{\\colortbl;\\red0\\green0\\blue0;\\red255\\blue255\\green255;\\red128\\blue128\\green128;\\red0\\green255\\blue0;\\red100\\green100\\blue100;\\red0\\green0\\blue255;\\red0\\green255\\blue255;\\red0\\green0\\blue0;}";
rtLink.Rtf = @"{\rtf1\ans1 " + clrTable + "\\cf1 \\cf4 \\v ftp:\\v0Help \\cf1}";
"ftp:" is used to create "Help" as link. The clrTable has no effect in deciding the link color. When uses "ftp:", it is having default link color blue. Is there any other way to change the link color.
Please help.. Thank You,
Linda.
|
|
|
|
|
Hey! I ran into a little problem today... i think it's an easy one, but i don't have the answer. I have a string n declared and i want to delete all the rows in one database(sql) which contain that string(completely, not parts of the cells in the databases). so i wrote:
SqlConnection sqlconn = new SqlConnection();
sqlconn.ConnectionString = "Data Source=CATA;Initial Catalog=datagrid;Integrated Security=True;Pooling=False";
sqlconn.Open();
SqlCommand sqlcomm = new SqlCommand();
sqlcomm.CommandText = "DELETE FROM datagrid WHERE name ='"&n&"'";
sqlcomm.Connection = sqlconn;
sqlcomm.ExecuteNonQuery();
but i get the following message when i try to run the program: Error 1 Operator '&' cannot be applied to operands of type 'string' and 'string'
-- modified at 7:35 Tuesday 23rd May, 2006
|
|
|
|
|
drc_no1 wrote: sqlcomm.CommandText = "DELETE FROM datagrid WHERE name ='"&n&"'";
that would be:
WHERE name ='" + n + "'";
|
|
|
|
|
Yup, it works. Thanx a lot!
Now i have another problem... I have a datagrid and i have added one button column called delete. when i press delete, i want my row to disappear. But, i can't find a suitable event for clicking that button. all i find is cell content click or any other that aplies to the whole row, not only to that cell contining the row. Can u help me, pls?
|
|
|
|
|
While HollyHoo's suggestion would probably work, I suggest you read this[^] article to know why your code is vulnerable to SQL injection attacks.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
|
Hi,
I'm trying to manipulate files in a C# program, when I delete a file however I run in to problems. It seems the file isn't really deleted until my application exits. I've tried it through File.Delete() and FileInfo.Delete(), and it seems to make no difference.
The problem comes when after I have deleted the file I rescan the folder using Directory.GetFiles() and the "deleted" file is still there, except I can't read it.
Do I need to somehow flush my file deletion??
Thanks in advance.
|
|
|
|
|
Hi Gubber,
did you opened the file before? Maybe there is still an open stream or somthing like this on the file. Maybe you should try to dispose the stream before?
Regards
Sebastian
|
|
|
|
|
Thanks!!
That was exactly it.. I had opened a stream and forgot to Dispose of it.
Cheers!
|
|
|
|
|
Hi All,
I have made a class Words.....and m using an array of it.....and i want to sort this array according to its data member Term (it also has other data members). which is a string....wat is the easiest and effeiceint way of doing it plzz tell in detail
looking forward for help
Regards,
|
|
|
|
|
See this article.
You need to implement the IComparable interface and add a function CompareTo to your class.
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Hi Sir,
Well the article u have suggested is quite complex coz i think it is about sorting objects of different classes.....i just need to sort object of a single class on the base of a specific data member........isnt there any easy way to do this
Looking forward for help
Regards,
|
|
|
|
|
You should also have read his second sentence. Here a little example:
public class MyClass : IComparable {
private string _myValue;
public int CompareTo(object o) {
return _myValue.CompareTo(((MyClass)o)._myValue);
}
}
|
|
|
|
|
how can i call this in my class? and wat is the purpose of this _myValue variable.
looking forward for help
Regards,
-- modified at 11:59 Tuesday 23rd May, 2006
|
|
|
|
|
Ok some more details :
MyClass is the class you want to get sorted.
_myValue is the field or whatever by which you want to sort the data. Instead of using a field you could also use a property or something else.
Now assuming you have filled instances of this class into an ArrayList you can sort it with:
list.Sort();
If you have an array (MyClass[] myArray) of your object than you can sort it with:
Array.Sort(myArray);
Internally the Sort methods will call CompareTo to determine the correct ordering.
|
|
|
|
|
Hi Sir,
i am trying to do this in this way
public class TextMiner : System.Windows.Forms.Form , IComparable
{
public Terminology[] word = new Terminology[WORDS];
private string strValue = "term";
public int CompareTo(object obj)
{
Terminology w = (Terminology) obj;
return( strValue.CompareTo( w.term ));
}
public void Indexer()
{
Aray.Sort(word);
}
}
it compiles without any error but it throws this exception during execution
An unhandled exception of type 'System.InvalidOperationException' occurred in mscorlib.dll
Additional information: Specified IComparer threw an exception.
tell me what i m doing wrong and how i can correct it....
looking forward for help
Regards,
|
|
|
|