|
The files seem to be missing from that webpage
|
|
|
|
|
Hi!
I have a question. I have a DataGridView that displays some records and beside it I have another DataGridView.
How can I double click on a record in DataGridView1 so that the record appears in DataGridView2? It's basically an assignment function where I double click the records I need and they are displayd in the second gridview.
I know that I have to execute the code in the double click event of the datagridview but I have no idea how to add the selected record to datagridview2
Thank you in Advance!!
Illegal Operation
|
|
|
|
|
You'd have to read the data from the record, put it into an acceptable data source, like a list, and apply it to the second view.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Why? What are you trying to accomplish? Are you copying data?
Anyway, I very rarely use a DataGridView, they're generally not very appropriate for production applications (they're really only good for making quick-and-dirty prototypes and demoes).
|
|
|
|
|
PIEBALDconsult wrote: they're generally not very appropriate for production applications
It's the first time I here this, why do you find it inappropriate for production applications?
|
|
|
|
|
There's usually a better way to present the data; very few applications (pretty much just spreadsheets) work well as a grid.
|
|
|
|
|
Ok, it's from a functional level, not because the control is 'bad'.
|
|
|
|
|
|
Are you using "data bound" grids or "unbound" grids?
If you're using "unbound" grids, then retrieve the selected DataGridViewRow(s) and copy them to the second grid.
If you're using "bound" grids, you should be using a typed dataset with 2 tables of the same type, and using the methods of the typed tables to retrieve the selected row(s) and adding them to the second table.
(see the grid's .SelectedRows and row .Selected properties for starters).
|
|
|
|
|
look into the datagridviews.Rows.Add function. I think it even takes a DataGridViewRow object. extract that object from your first datagridview and your done.
hope this helps.
|
|
|
|
|
I can't understand how I can make double buffering work in my project. I read many of forums, but no one solution make it work.
I draw on child class of pictureBox - DBPictureBox(my class). When mouse moving on that DBPictureBox it was redrawing. That's all.
Below i post to show how it is works:
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
pixel = true;
Graphics graph = pictureBox1.CreateGraphics();
master = new WishMaster();
Size size = new Size(pictureBox1.Size.Width - 1, pictureBox1.Size.Height - 1);
plane = new CellPlane(size, graph);
dots = new Point[0];
tableLayoutPanel1.BringToFront();
}
protected override void OnPaint(PaintEventArgs e)
{
plane.drawplane(10);
if(dots.Length != 0)
plane.drawline(dots, pixel, 0);
plane.drawpointer(pointer);
}
protected void PlaneMouseMove(object sender, MouseEventArgs e)
{
pointer = e.Location;
toolStripStatusLabel2.Text = pointer.X.ToString();
toolStripStatusLabel3.Text = pointer.Y.ToString();
Invalidate();
}
}
drawplane - is function of my class that drawing cell table. If it necessary i can post it.
DBPictureBox is:
class DBPictureBox : PictureBox
{
public DBPictureBox()
{
DoubleBuffered = true;
}
}
But DBPictureBox flickering yet.
modified on Wednesday, November 11, 2009 7:37 PM
|
|
|
|
|
DerDevil wrote: Graphics graph = pictureBox1.CreateGraphics();
Why do you do this ? If you're drawing on that graphics object, then your call to double buffering is useless and never does a thing.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Why not?
class DBPictureBox : PictureBox
{
public DBPictureBox()
{
DoubleBuffered = true;
}
}
Is this doesn't mean that DBPictureBox must to use DoubleBuffered. And if it useless, what i must to do?
|
|
|
|
|
Try this in the constructor:
SetStyle(ControlStyles.AllPaintingInWmPaint, true);
SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
modified on Thursday, November 12, 2009 4:50 AM
|
|
|
|
|
It didn't solve a problem.
|
|
|
|
|
I am new to C# programing and I would like learn.I am using Visual Stuido 10 beta right now, and the only other programming I have done is in Html, PHP, and Java script.I've been doing some reading and been through the "hello world" Windows form app. Yeah I know, I am a master already right....
Anyway's I need some advice/help, just to get me going in the right direction. I have set up a game plan and a list of what I would like the program to be able to do. The idea is, a advanced media suite.Here are the fuctions I would like to incoperate into the project.
1)Video/DvD Player - Able to play video from the dvd drive and be able to play most popular video file types.
2)Audio player -able to play most audio file types like .wav, .mp3, and so on.
3)Picture Viewer/Slide show - Able to show most file types
4)Audio/Video/Picture burning - Able to burn the three media types to cd-r/dvd-r.
5)Video/Audio Conveter - Able to convert a wide range of file types to another
So, I was hoping to get this done by tomorrow. Joking
I know this might be a lot, and understand it might take take a good amount of time to complete. But is all of this realistic, or am I thinking of way to much for one person to be able to do in a life time? I would like to make most of them pretty advanced is possible. For exsample,
Video player fuctions:
Forward
Back
Next Chapter
Previous Chapter
Stop
Puase
Play
Volume
Mute
Full Screen
Captions
ext...
I would like to focus on the Media Player part first. I am pretty sure I found a few tutorials that will help me with the basic fuctions. I would like to steer clear of using fuctions of Windows Media Player. Once I can get down a good working Media player, I would like to release it as a open source beta project, releasing the other fuctions over a period of time as a new "Release". So any tips or links to useful information would be pretty cool.
Oh, and if I get stuck and need some guidence, Is it ok just to post it in the form, instead of making a new topic?
|
|
|
|
|
Most of this stuff is either incredibly complex or incredibly easy. Using the windows media player control to actually do it, it's very easy. You'd do better to learn C# first, rather than just learning how to use the WMP control.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
MattWeed9 wrote: I would like to steer clear of using fuctions of Windows Media Player.
OK, in that case, all of this is pretty much fantasy, in my opinion. You might get some functionality via DirectX, but I'm not sure how much. Certianly there is no way this is a valid project to start as a follow up to 'hello world'
MattWeed9 wrote: Oh, and if I get stuck and need some guidence, Is it ok just to post it in the form, instead of making a new topic?
If you reply to this thread, the issue is that your posts will quickly be buried by newer ones. CP does not bump posts that get new replies.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Thanks for the reply. I didn't really paln on getting all of this done. I am more of a learner through trial and error then just readingink, noth out of a book. I haven't done any form of programming in years, but I would like to thing in impossible.
From what I read on the net, it made it seem like C sharp was the "Ideal" langauge for developing windows applications. Is it, just that C# is not capible, or more of it would require a lot of time and understanding? I am 28 years old, I've got some time to kill.
|
|
|
|
|
MattWeed9 wrote: From what I read on the net, it made it seem like C sharp was the "Ideal" langauge for developing windows applications.
At this point, that is probably true.
MattWeed9 wrote: Is it, just that C# is not capible, or more of it would require a lot of time and understanding?
DirectX and Windows Media Player represent Microsoft doing all the hard work in writing the components to deal with video and audio files. It's that, as a beginner, the mp3 compression code alone is a major project, let alone writing to a CD or playing a video file.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Alright, thanks. Think I will try and work on some basic stuff for awhile to get more familar.
|
|
|
|
|
I am thinking this is a Windows thing but after my application closes, the notify icon will still appear in the taskbar. The only time it will disappear is when you roll your mouse over it.
Could there be something wrong that I am doing (that maybe Visual Studio is doing something wrong) or is this just something messed up with Windows OS?
This happened on XP but I am currently on Windows 7 and it is doing the same thing. Thats why I chose to ask the question.
I am using some background workers in my application but they should be ended when the application exits. I have also checked the task manager and do not see the application running
|
|
|
|
|
This happens on all kinds of Windows.
Your app should call Dispose() on its NotifyIcons prior to app exit.
One way of achieving this is by using
protected override void Dispose(bool disposing) {
if(disposing) {
notifyIcon.Dispose();
}
}
If your app does not, or just crashes, or gets killed, the icon remains intact until your mouse erases it. Unless you got this nice little tool[^] up and running (except it needs a fix for Win7).
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
|
|
|
|
|
Sweet that works! Sounds like Windows wasn't very good at cleaning up?
|
|
|
|
|
i had the same problem, and fixing it is quite easy,
in your Program.cs text just place :
myIcon.Dispose();
right after Application.Run(new myForm());
the code should look like:
Application.Run(new myForm());
myIcon.Dispose();
that way when your application exits, the icon will hide
|
|
|
|