|
Hi,
My requirement is to set combobox column for deptno column of the table dept.
When insert button is clicked,i write the following code
DataGridViewComboBoxColumn cell = new DataGridViewComboBoxColumn();
cell.DataPropertyName = "DEPTNO";
cell.HeaderText = "dno";
cell.Items.Add(10);
cell.Items.Add(20);
cell.DataSource = ds.Tables["dept"];
cell.ValueMember = "DEPTNO";
cell.DisplayMember = "deptno";
dataGridView1.Columns.Add(cell);
dt=new DataTable();
dt = (DataTable)dataGridView1.DataSource;
DataRow dr = dt.NewRow();
dt.Rows.Add();
dataGridView1.DataSource = dt;
My problem is that combobox column is displayed as a separate column.But it value member set to deptno column of dept table.And when i select 30 from that combo box control goes to deptno=30 row.
I want combox cell is set for deptno column and when we select a value from that combo box column the velue is displayed for that row.
How to do this.
Thanks in advance.
|
|
|
|
|
Hi
I need some help. Im a beginner.
I want to create a abstract class called CustomTabPage which inherits from TabPage class. Reason why Im doing this is because after creating this class I want to create several classes which inherit from my CustomTabPage, which are objects that I will create instances of.
How do I go about setting the size and other properties in my CustomTabPage class?
I hope this makes sense.
|
|
|
|
|
Everyone always tells me to override OnPaint. You might try that.
-Daniel
Typing too fast fro my owngood
|
|
|
|
|
I am repeatedly adding status strings to a textBox (a simple progress dump from my app.)
For Example:
textBox1 += "some status\r\n"
Eventually, the latest info. added is not visible. The textbox continues to display the caret in front of the first character, and only the first 'n' lines of text are visible.
I want the reverse, the caret at the end of all the text and the last 'n' lines visible.
How do?
Thanks
NIK
Note: I want to retain all of the data, so I need to adjust the scrolling/display rather than just chopping the data up.
|
|
|
|
|
try using the Select method with start- and endindex to the index of the lastcharacter...?
hope this helps.
Coulda, woulda, shoulda doesn't matter if you don't.
<marquee>
|
|
|
|
|
It set the caret, but didn't modify the text display
|
|
|
|
|
Then you use the ScrollToCaret() method.
-Daniel
Typing too fast fro my owngood
|
|
|
|
|
another way is to use
textBox1.AppendText("some status\r\n");
instead of textBox1.Text += "some status\r\n";
Regards
Shajeel
|
|
|
|
|
Bingo! Perfect.
Thanks to all.
NIK
|
|
|
|
|
Hi
I know multithrading is explained in several tutorials, but I can't figure out how to terminate another thread gracefully. This is my current code. In thread1 when I dispose s I get an error... I realised this would happen with sychronisation etc. What can I do?
public class Loader<br />
{<br />
PNG.SplashScreen s;<br />
Form1 f;<br />
Thread first;<br />
Thread second;<br />
public Loader()<br />
{<br />
first = new Thread(new ThreadStart(thread1));<br />
second = new Thread(new ThreadStart(thread2));<br />
first.Start();<br />
second.Start();<br />
}<br />
void thread1()<br />
{<br />
f = new Form1();<br />
s.Dispose(); <br />
f.ShowDialog();<br />
}<br />
void thread2()<br />
{<br />
s = new PNG.SplashScreen();<br />
s.ShowDialog();<br />
}<br />
}
cheers
|
|
|
|
|
You can't really terminate another thread gracefully. You either kill it ungracefully via someThread.Abort (which injects the ThreadAbortException into the thread being aborted), or you can cancel gracefully by having someThread check for some boolean cancel state over time and exiting when it hits that state.
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Goof around music jam with my brothers (with video)
The apostle Paul, modernly speaking: Epistles of Paul
Judah Himango
|
|
|
|
|
You error most probably comes from the fact that it is only safe to alter GUI elements from within the thread they where created in. Have a look at the Invoke[^] method.
|
|
|
|
|
I will appreciate if some can recommend/advice on which book one can get to learn visual C# a Needed the skill to improve ,right now working windows application
|
|
|
|
|
If you go to the store, many books will suffice for starting out. What I definitly would learn is the ADO.NET part, make sure there is enough explanation on that in your book (more than 1 chapter) or buy another one that specifically handles ADO.NET.
Coulda, woulda, shoulda doesn't matter if you don't.
<marquee>
|
|
|
|
|
i have been reading a couple books:
-Microsoft Visual C# 2005 Step By Step
-Visual C#® 2005: How to Program, Second Edition
They are both good books in my opinion
Don't be overcome by evil, but overcome evil with good
|
|
|
|
|
I am new to the programming world.
I will appreciate if some can recommend/advice on which book one can get to learn C# and SQL
Presently, am a systems support engineer on windows platform.Needed the skill to improve on my network infra design.
Any tips/advice on how to learn C# and SQL will be appreciated.
thx
Endless is the Quest for Knowledge
|
|
|
|
|
There are books for learning to become a MCAD (microsoft certified apps dev), but they are actually good beginners books.
For C# / Sql, try Amit Khalani's MCAD 70-616 Training Guide, its really simple, yet gets a lot of info across
just-code-it.net
Managed DirectX & C# Tutorials
|
|
|
|
|
|
Jesse Liberty's "Programming C#" on O'Reilly Press. Get the updated version for .NET 2.0. Its really written for programmers who want to learn C#, rather than people who want to learn how to program using C#. It was the book my C# professor used, and it is a WONDERFUL reference. In addition, anyting in the Microsoft .NET Development Series helps. I have their books on ADO.NET and data binding in windows forms.
Also, the articles here on codeproject are great too. I've definetely used a couple to learn what I need to overcome some issues I've had.
Good luck.
-- modified at 16:45 Tuesday 30th May, 2006
On Amazon:
Programming C#[^]
OR
Learning C#[^] if you think that might be better.
|
|
|
|
|
I design a messenger like hotmail and yahoo. i connect with hotmail server but face some problem in fetching address book which are added in my messenger. can any body help me for this problem the tool i using is c#
thanks
from Musharaf
|
|
|
|
|
Can anyone help me with this small problem, The cell position of a ListView is worked out by the mouse_click x,y and the width of the columns. Is there any way to account for the hidden portion of the control when a form is resized and a scroll bar introduced?
i.e.
Example problem with incorrect x,y co-ordinates due to scrollbar offset.[^]
Any help would be appreciated, thanks
Darren
|
|
|
|
|
Are you using ListViewItem.Bounds ?
|
|
|
|
|
No, the problem is before i need the bounds of the SubItem i need to work out which SubItem it is... using the folowing MouseDown event handler i get the current x,y position of the mouse relevant to the form but it does not account for the 'actual' size of the listview, only the visible portion (or maybe gives me x,y from top-left of the form overall not sure). So somehow i need to get access to the correct size of the ListView irrelevant to the size of the form.
public void EAL_MouseDown(object sender, MouseEventArgs e)
{
li = this.GetItemAt(e.X , e.Y);
X = e.X ;
Y = e.Y ;
}
I found this article: http://www.codeproject.com/cs/miscctrl/CSharpHitTest.asp
and it has some interesting comments on the horizontal scrollbar problem, gonna chase them up.
Thanks
Darren
|
|
|
|
|
How do I catch for e.g. a <ctrl> + s (User want to save) to my Form (C#).
_____________________________
...and justice for all
APe
|
|
|
|
|
If you want to add a shortcut key combination to an event handler you could look at the:
System.Windows.Forms.Shortcut. pre defined set.
such as:
System.Windows.Forms.Shortcut.CtrlS; for Ctrl + S.
if you wanted to add this to an event handler for a menu bar for e.g. you would do this for an Exit item with Ctrl + X as shortcut keys:
Menu.MenuItems.Add(new MenuItem("E&xit", new EventHandler(this.FileExit_Clicked), Shortcut.CtrlX));
where FileExit_Clicked is your event handling method.
|
|
|
|