|
Well that's easy, once again I was looking for a more difficult solution!!!
Thanks for the help.
Gary
|
|
|
|
|
There is a property of the Windows Forms DataGrid called RowHeadersVisible. I set it to false, but the row headers never seem to disappear. Has anyone had any success getting row headers to disappear?
Thanks!
Mark
|
|
|
|
|
If you have used custom table and column styles, then you need to turn that property off on the DataGridTableStyle object.
|
|
|
|
|
Thanks Brian! That is exactly what it was.
Mark
|
|
|
|
|
hi,
I wrote an article for DataGridFormattings. That will help you out from this senario.
Sreejith Nair
|
|
|
|
|
Need Help Passing DataSet to another Windows form.
Connection is created on frmMain but need to access it in frm add to add a new record to database. ????
Can someone help me????????????
|
|
|
|
|
hi,
We can pass our dataset to any layer which our application have. Here your idea is to pass a dataset to one form to another. so what you can do is, write a parameterised contructor of you second form. And call this overloaded constructor when you want to create instance of the seconf form and want to access the dataset object.
I am sure that, this will serve your purpose.
Sreejith Nair
|
|
|
|
|
Need Help Passing DataSet to another Windows form.
Connection is created on frmMain but need to access it in frm add to add a new record to database. ????
Can someone help me????????????
|
|
|
|
|
Hello,
My latest effort involves allowing the user to copy a file out in the Windows shell (explorer, etc) and then be able to paste it into my application. So, they find a file "jinkies.jpg", press crtl-c, and then enter my app and click the edit menu, paste is available, and they paste, bringing the data into the program. What I would really like is to just get the filename(s) of the pasted files--then I can do whatever is necessary with the files (read them in, etc).
So there's really 2 questions:
1. How do I make my program aware of whether something is available for pasting on the clipboard, of the appropriate format (copied files)?
2. How do I bring this data into my program in an understandable format?
BTW: I am not working with images, that was just an example. I have already seen implemented the drag-and-dropping of files into a .NET app, and there you can get the filenames quite easily.
|
|
|
|
|
Well, by experimenting I was able to find out how to get data--the formats (!) for files copied at the shell include "Shell IDList Array", "FileDrop", and "FileName" among others. Still, is there some way I can monitor when data becomes available in the clipboard? Thanks a lot!
vir·tu·al re·al·i·ty
n. Abbr. VR
A computer simulation of a real or imaginary universe in which Microsoft APIs are thoroughly documented and behave in an entirely logical manner.
|
|
|
|
|
Recently I wanted to create a small little program that could sit on the desktop and not block the desktop wallpaper. There are two methods to accomplish this ( that I am aware of ).
1) create a solid color bmp as a background image and set the transparency key to match its color
2) specify the form's background color with a matching transparency key
Now my issues with both methods, but first it should be known that I have set the forms to have no border or title bar and have implemented code that allows me to click-and-hold anywhere ( with exceptions listed below ) on the form and move it. The data actually displayed on the form is just text and one rectangle, all drawn by me ( there are no controls on the form itself ).
1) I have two issues with this method, although it is what I'm prefering to use at the moment. The first seems to be the discrepancy between how the program is handled when the computer's Color Depth is 32bit or when it is less than 32bit ( 16bit ). When the color depth is 32bit then I am able to click on the entire area the form inhabits ( even that which is transparent ) and move it, but if the color depth is less than 32bit ( 16bit ) then only the drawn text or rectangle outline ( since it has no fill ) can be clicked to drag the program around. Clicking on the transparent areas just passes the click through the form to whatever is below ( even when I know the form has focus ). I'd like to be able, regardless of the desktop's color depth, to click anywhere within the form area and move the application.
The second issue I have with this method occurs when I take my executable and put it on another PC ( my PC is XP Pro, the other PC is XP Home.. Both SP2 ). The problem is similar, but a little different. When the 2nd PC's color depth is at 32bit, the transparency does not work. The green/lime ( that's the transparent color I'm using ) background shows. Needless to say this is not acceptable. When I change the color depth to less than 32bit ( 24bit this time ), the transparency actually works, but I come across the same issue of clicks on the transparent areas just passing through.
2) With this method I have not tried it on a 2nd PC yet ( I don't have it available where I am atm ). Its basically the same "issue" as mentioned above with color depth less than 32bit, except it does it with a color depth of 32bit and 16bit. Clicks on the transparent areas just pass right through. I'm tempted to just go with this method and possibly make one area on the form that is meant to be used to drag it around ( similar to the idea of the box that appears to move tables in MS Word ), but I'm hoping there's a solution I'm unaware of before I do that.
Anyways, all of this brings up some interesting questions.
-What does color depth have to do with transparency handling?
-Does the version of XP ( Home or Pro ) handle transparency differently?
Probably some more questions also.
Not sure if it matters, but I'm doing all of this in C#.
So any ideas to get pass any of these issues?
Thanks in advance.
|
|
|
|
|
I found this code somewhere and changed it for use in my project. It doesn't work and I can't find anywhere or anyobe who can tell me how to work with a datagrid.
Is it a big secret? Is no one allowed to know how to work with this bloody thing?
This is the code:
partial class frmWords : MNLForm
{
OleDbConnection myConn;
OleDbDataAdapter myAdapter;
DataSet ds;
OleDbParameter workParam = null;
string myQuery = "select ID, Word from Thai";
public frmWords()
{
InitializeComponent();
ConnectToData(); // establish database connection and create DataSet
grdThaiWords.DataSource = ds.Tables[0].DefaultView;
//myGrid.SetDataBinding(ds, "CardTest");
DataTable t = ds.Tables[0];
t.RowChanged += new DataRowChangeEventHandler(Row_Changed);
}
private void Words_Load(object sender, EventArgs e)
{
}
public void ConnectToData()
{
ds = new DataSet();
myConn = new OleDbConnection(System.Configuration.ConfigurationSettings.ConnectionStrings["Dictionary"].ConnectionString);
myAdapter = new OleDbDataAdapter();
myAdapter.SelectCommand = new OleDbCommand(myQuery, myConn);
myAdapter.Fill(ds, "Thai");
insertCommand();
updateCommand();
}
public void updateCommand()
{
string updateQuery = "Update Thai Set Word = @Word WHERE ID = @ID";
myAdapter.UpdateCommand = new OleDbCommand(updateQuery, myConn);
workParam = myAdapter.UpdateCommand.Parameters.Add("@Word", OleDbType.Char);
workParam.SourceColumn = "Word";
workParam.SourceVersion = DataRowVersion.Current;
}
private void Row_Changed(object ob, DataRowChangeEventArgs e)
{
DataTable t = (DataTable)ob;
Console.WriteLine("RowChanged " + e.Action.ToString() + "\t" + e.Row.ItemArray[0]);
}
public void insertCommand()
{
string insertQuery = "Insert into Thai VALUES (@Word)";
myAdapter.InsertCommand = new OleDbCommand(insertQuery, myConn);
workParam = myAdapter.InsertCommand.Parameters.Add("@Word", OleDbType.Char);
workParam.SourceColumn = "Word";
workParam.SourceVersion = DataRowVersion.Current;
}
public void UpdateValue()
{
try
{
myAdapter.Update(ds, "CardTest");
Console.Write("Updating DataSet succeeded!");
}
catch (Exception e)
{
Console.Write(e.ToString());
}
}
}
I just want a datagrid that does a update when something is changed and inserts when there is a new row.
Thanks
|
|
|
|
|
I am currently working with the Windows Form DataGrid and i am finding the lack of information on it very frustrating. The link below provides a good series of articles on its use.
www.codeproject.com/csharp/PracticalGuideDataGrids1.asp
What I don't understand is why Microsoft relies on the developers to document THEIR controls.
Mark
|
|
|
|
|
There's a new DataGridView control in Windows Forms 2.0 that addresses many of the problems with the existing DataGrid. Fortunately the documentation for the new one is now like all other WinForms controls.
Judah Himango
|
|
|
|
|
Hi every body...
I need to know the method off finding the physical IP address for a user who is
Connecting internet through a DSL line...
I prepared a client server application and when any one of the clients who
Are connected to internet through a DSL or any leased line tried to connect
To my server he cannot connect to it...
The server is having a physical IP address and I am establishing the
Connection with a dial up connection...
Any user who are connected through a dialup can access otherwise they cannot
...
Pls help in finding the way for getting the physical IP or assigning an IP
For a machine with DSL connection to establish the connection with it
|
|
|
|
|
do i have to mess with the alpha to get some of those nice bluish colors with a white tint that outlook 2003 has for buttons? i can only create solid looking colors with FromArb, right?
|
|
|
|
|
Hi vista27,
I don't think that those buttons and other "gradient color" components use transparency/alpha. Probably what the Outlook programmers did was make their own "custom" button class by inheriting a new class from System.Windows.Forms.Button and overriding its painting methods (OnPaint comes to mind).
In the override you would use GDI+ to paint a gradient-colored rectangle or oval (or whatever) instead of a solid color rectangle. There's a LinearGradientBrush class in GDI+ that would do what you're looking for--you would make that brush and use it to fill the rectangle/oval/etc. You would have to print out the button's text and stuff, or you could call base.OnPaint() first and then draw over it.
|
|
|
|
|
awesome. thanks for the info. i had one more question, though. what do you suggest i do with an icon image? i have buttons with icon images. i've redrawn the text, but now i need to replace the icon, but it doesn't seem to show up.
if i do as u suggestion by calling base.onPaint first, the gradient still seems to wipe out everything.
thanks!
|
|
|
|
|
My bad on the calling base.onPaint first, it's just not going to work. As far as drawing an icon image, if you're using the button's Image property there's a method in Graphics called DrawImage that's probably what you're looking for.
I believe there's articles about this stuff out on the main site, too, with all sorts of fancy features.
vir·tu·al re·al·i·ty
n. Abbr. VR
A computer simulation of a real or imaginary universe in which Microsoft APIs are thoroughly documented and behave in an entirely logical manner.
|
|
|
|
|
Hi,
How to configure visual studio for debugging in https(ssl) mode a WebApplication in c#?
Thank a lot four help.
-=zoltx=-
|
|
|
|
|
I am working with the .NET DataGrid in C#. I thought I saw an article on the Code Project site which explained how to get rid of the last row in a DataGrid, the one with the asterisk next to it. Does anyone know the article? Or know how to do it?
Thanks!
Mark
|
|
|
|
|
|
Thanks Roy for the quick response! That is a great article!
Mark
|
|
|
|
|
Hmmm. I can't seem to get this to work.
At the statement:
CurrencyManager cm = (CurrencyManager)(this.BindingContext[dataGrid1.DataSource, dataGrid1.dataMember];
I get an error:
"Cannot create a child list for field myTable". myTable is the name of the single table in the dataset.
Any ideas?
|
|
|
|
|
I've used this in the past
DataView dv = new DataView(myDataTable)<br />
dv.AllowNew = false<br />
dataGrid1.DataSource = dv
|
|
|
|