|
did you mean by using data binding or by the code
if you mean data binding i think you can not
bind combo box to two fields
in the code get the data and loop for each recored add the two fields value
|
|
|
|
|
i'm getting only the names in the combobox, but i also want the description to be next to the name separated by space.
m doing it as below...
newColumnStyle.MappingName = "New";
newColumnStyle.HeaderText= "New";
newColumnStyle.Width = 101;
newColumnStyle.MyComboBox.Items.Clear();
for(int i = 0; i < getData.Length; i++)
newColumnStyle.MyComboBox.Items.Add(getData[i].name );//here how to add in the combobox the 'getData[i].description'
tableStyle.GridColumnStyles.Add(newColumnStyle);
any help appreciated
|
|
|
|
|
try somthing like this
newColumnStyle.MyComboBox.Items.Add(getData[i].name + " " + getData[i].description)
|
|
|
|
|
thanx...silly me dinn think of concating...
but my problem ain't solved yet.
when i select one of the names, and then i fill in other columns other details, and click on 'save' button, only the name should be saved and not the description...
in save button click,
for each row,
for (int i = 0; i < dataTable.Rows.Count ;i++)
{
testData.name = Convert.ToString(dataGrid1[i ,2]).Trim();
//other details from the datagrid
//then i call a function to add the details from the datagrid in the database
addDetails(testData);
}
thanx for helping
|
|
|
|
|
you need to extract name only
some thing like the following will extract it
//text that contain both name and description
//" " the sperator replace it with your own
<br />
string name=text.Substring(1,text.IndexOf(" ")+1);
then testData.name=name
|
|
|
|
|
thank u
|
|
|
|
|
HI All, I want to write a "Send To" menu class using C#(it's function just link the "Send To" Menu in the windows OS,send files to a specified target,such as desktop,MyDocument,Mail Recipient etc.), and I've finished it ,but there is still some problems .I use COM code (use IShellFolder,IDropTarget etc.) to do this work, this is too complex I think, so I want to know are there any simple ways to do it?
Can we use command line to do it?
|
|
|
|
|
lin1161 wrote:
I use COM code (use IShellFolder,IDropTarget etc.) to do this work, this is too complex I think, so I want to know are there any simple ways to do it?
Can we use command line to do it?
How would you expect your command line code to make it into the shell ? The shell uses COM, you need to use COM to interface with it.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
If we can't use command line to do it , are there any other simple ways to do it?
|
|
|
|
|
As has been pointed out, there are no simpler ways than using the COM interfaces.
Sorry, you have to live with it.
Regards,
mav
|
|
|
|
|
|
Why ? He's already written it, he's saying it's too complex. This project does the exact same thing he has done, using the same COM interfaces.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
because he said "but there is still some problems "
i thought this code may help him
any way no problem
|
|
|
|
|
Thank you for your reply. I had seen it .It was written in c++,it also used COM code just as i did in c#, and this time I want to use a simple way to do it .
|
|
|
|
|
Please help me ,and this is really important to me.I will wait on line day and night.Many thanks!
|
|
|
|
|
look, several people have given you the answer. If you can live with it or not, is up to you. The answer won't change.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
There is another problem , I add the "Send To" menu items in the System's Send To folder , in win2000 ,all the "Send To" menu items are in this folder ,but in win_xp there are some items not in the system's Send To folder (such as floppy disk,DVD RW Drive),but they appears in system's send to menu. I just want to know does Windows puts “Removeable Drives” in the Send To menu automatically?
|
|
|
|
|
Obviously, it does.
While trying to fiddle around with the various places where SendTo entries can come from I guess it'd be faster to learn about the COM interfaces that should give you all SendTo targets, regardless of whether they are links in certain directories, registry entries or anything else.
mav
|
|
|
|
|
Which COM interface should I use to get all Send To targets?Please give me some useful information .Many Thanks!
|
|
|
|
|
how can i send data to a web page (PHP, ASP, JSP) using http get or post and the results of the post/get
|
|
|
|
|
.net framewrok have HttpWebResponse and HttpWebRequest
which will help you to do your task
in easy step
Create HttpWebRequest
set properties like method -Post,Get- ,contenttype
set proxy if you belong one
Create Stream and send Data
GetResponse
|
|
|
|
|
When I create a application with a empty form ,I use followed function to handle KeyDown event :
private void Form1_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
{
switch (e.KeyCode)
{
case (Keys.Left) :
MessageBox.Show("You have pressed Arrow-Key Left");
break;
case (Keys.Right) :
MessageBox.Show("You have pressed Arrow-Key Right");
break;
}
}
The application runs well but when I add a new button , this function can't handle the KeyDown event ,this code no longer runs properly.Why ?
I use Visual Studio .Net 2003.
Sorry if my English is not good.
This is all code :
-First is Empty form(Run well) :
namespace WindowsApplication2
{
public class Form1 : System.Windows.Forms.Form
{
private System.ComponentModel.Container components = null;
public Form1()
{
InitializeComponent();
}
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
private void InitializeComponent()
{
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(292, 266);
this.Name = "Form1";
this.Text = "Form1";
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.Form1_KeyDown);
}
#endregion
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
private void Form1_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
{
switch (e.KeyCode)
{
case (Keys.Left) :
MessageBox.Show("You have pressed Arrow-Key Left");
break;
case (Keys.Right) :
MessageBox.Show("You have pressed Arrow-Key Right");
break;
}
}
}
}
- After add a button :
namespace WindowsApplication2
{
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.Button button1;
private System.ComponentModel.Container components = null;
public Form1()
{
InitializeComponent();
}
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
private void InitializeComponent()
{
this.button1 = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// button1
//
this.button1.Location = new System.Drawing.Point(104, 80);
this.button1.Name = "button1";
this.button1.TabIndex = 0;
this.button1.Text = "button1";
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(292, 266);
this.Controls.Add(this.button1);
this.Name = "Form1";
this.Text = "Form1";
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.Form1_KeyDown);
this.ResumeLayout(false);
}
#endregion
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
private void Form1_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
{
switch (e.KeyCode)
{
case (Keys.Left) :
MessageBox.Show("You have pressed Arrow-Key Left");
break;
case (Keys.Right) :
MessageBox.Show("You have pressed Arrow-Key Right");
break;
}
}
}
}
le van giang
|
|
|
|
|
You need to set a property on the button so that the keyboard event it recieves when it has the focus is passed to it's parent.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
because when you add button control it has a focus when the form run
so the message goes to button not to the form
|
|
|
|
|
But when I set focus to Form :
Form1.Focus() ;
It still not runs.
le van giang
|
|
|
|