|
Hi sindhutiwari,
1) First retrive the data from database to DataTable.
DataTable objDataTable = new DataTable();
objDataTable.Columns.Add("DataColumn1");
objDataTable.Columns.Add("DataColumn2");
dr = objDataTable.NewRow();
dr[0] = "data1";
dr[1] = "yes"
objDataTable.Rows.Add(dr);
2) Now you can bind this datatable to datagridview. You should set the "DataPropertyName" property of datagridview column.
grdView.DataSource = objDataTable;
this.grdColumn1.DataPropertyName = "DataColumn1";
this.grdColumn2.DataPropertyName = "DataColumn2"; // grdColumn2 is comboboxcell it contains 2 items (yes/no). other values not accepted.
Regards,
Gopal.S
|
|
|
|
|
I am developing a simple phone book application and i need to save the contact photo when adding new contact
and retrive it again when searching for them later.
|
|
|
|
|
This is very simple to do. just upload image corrosponding to the contact person and disply it from database.
you can store image in database as binary format
or
you can store image in a folder and store the path with data base corosponding image
e,g:
ID Name Address ContactNo Image_Path
------------------------------------------------------
1 MyName MyAddress 123456789 d:\AppFolder\MyName.jpg
2 UrName UrAddress 987654321 d:\AppFolder\UrName.jpg
Just Do in this way !!
While retrive with id, or name use image box to show the image
Any more query ??? Always welcome !!!
|
|
|
|
|
thankx alot. thats was very helpul
thank you again
|
|
|
|
|
i have another question please
how can i set the path for my picture to be saved in one of my soulotion folder like the bin folder for example without wirriting the hole path
c:\progrm\....\myproject\bin?
|
|
|
|
|
using System.IO
This will return the current working directory !!!!
Directory.GetCurrentDirectory()
|
|
|
|
|
Hi Friends...
I Have a Problem with sending a Fax Using c# Language.
How Send a Fax From C# Application?
I Should Use what dll to Send a Simple Fax?
Thanks.
|
|
|
|
|
Probably through a telephony class.
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
hi
my code is not working .can any one suggest me.
private void Form1_KeyPress(object sender, KeyPressEventArgs e)<br />
{<br />
if(e.KeyChar==(char)27)<br />
{<br />
this.Hide();<br />
}<br />
}
ssk
|
|
|
|
|
You are hiding your form, not closing. If you want to close your form use this.Close()
Also, if you have controls on the form, make sure that your form is processing key press until they reach the controls
|
|
|
|
|
Hi!
The simplest way is to assign the button your users are supposed to close the form (Cancel, Close, ...) to the CancelButton property of your form.
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
can u tell in detail. i am a beginner. i never used the Cancelbutton of a form
thanks
senthil
|
|
|
|
|
You can add a button on the form and close the form when that button is clicked. Then in the properties of the form find Cancelbutton property and set it to the button which closes your form.
|
|
|
|
|
ya its working.
but one doubt, if i need this same task to be done without
creating a button and setting its property to cancelbutton means , how ?
dont think i am irritating u
senthil
|
|
|
|
|
Allowing the user to close a dialog by using the ESC key only is bad UI design style, so if you keep up a good style and provide a button you don't face the problem.
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
how can i make a first character in the word an upper case, is there any predefined function that do this?
Yesterday is a canceled check. Tomorrow is a promissory note. Today is the ready cash. USE IT.
|
|
|
|
|
use following code
textBox3.Text = textBox3.Text[0].ToString().ToUpper() + textBox3.Text.Substring(1);
or
string s = "srinivas";
s = s[0].ToString().ToUpper() + s.Substring(1);
textBox3.Text = s;
|
|
|
|
|
There is no predefined method to do that. Use Substring to find the first letter, and use ToUpper() to make it upper case.
|
|
|
|
|
In addition to what the others have said, you may want to use the overload of ToUpper() that takes a CultureInfo.InvariantCulture parameter.
Cheers,
Vikram.
"If a trend is truly global, then that trend ought to be visible across ANY subset of that data" - fat_boy
|
|
|
|
|
Sonia Gupta wrote: any predefined function that do this?
The methods ToUpper and Substring , as the others have said.
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
hi there,
today is my first exam of C# and other, some questions are confusing me, i dont have another way or time from where i can ask these question, so buddies please reply ASAP.
Q1.
A. In dynamic polymophism, appropriate methods of a program can be invoked, depending on the context.
B. In early binding(static), function calls are bound at run time.
a.) A true, B false
b.) A false, B true
c.) both true
d.)both false
Q2
is flow chart (OR and AND) rules are different from C#?
i mean in C# if we write like this:
if (a == 0 | a == 1)
{
//body
}
then any of is true(ie. a = 0 or a = 1)
then C# will enter the body.
is this will be same in flowchart or any other rule
i hope you people will understand what i wanna say.
please be in contact, more questions may asked
thanks
Becoming Programmer...
|
|
|
|
|
Q1 = A
not certain about second , i think it should be different but as we see it in logically meaning , it is true.but in representation it is different
Yesterday is a canceled check. Tomorrow is a promissory note. Today is the ready cash. USE IT.
|
|
|
|
|
are you from NIIT? because of some reasons
Becoming Programmer...
|
|
|
|
|
Yes[^]
Yesterday is a canceled check. Tomorrow is a promissory note. Today is the ready cash. USE IT.
|
|
|
|
|
wow nice to know, can you tell your center name?
Becoming Programmer...
|
|
|
|