我在Windows窗体上有一个DataGridView(Selectionmode:FullRowSelect)以及一些文本框,所以我想要做的是每当用户选择一行(可能是click或double_click)时,该行的内容必须显示在文本中箱,
我试过这个代码
private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
{
MessageBox.Show("CEll Double_Click event calls");
int rowIndex = e.RowIndex;
DataGridViewRow row = dataGridView1.Rows[rowIndex];
textBox5.Text = row.Cells[1].Value;
}
private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
{
int rowIndex = e.RowIndex;
DataGridViewRow row = dataGridView1.Rows[rowIndex];
textBox5.Text = dataGridView1.Rows[1].Cells[1].Value.ToString();// row.Cells[1].Value;
}
Run Code Online (Sandbox Code Playgroud)
还有很多其他的文本框,但主要的问题是没有一个事件似乎被触发,我应该使用什么事件这样做,或者是否有一些我可能设置错误的datagrid属性?任何帮助,将不胜感激...:(
可能重复:
如何在不破坏解决方案的情况下重命名项目
我知道这个问题经常被问到,但是没有一个可以帮助我克服由于不正确地重命名我的解决方案而使我的应用程序无用的担心,
我在VS 2008中正在开发一个C#Windows应用程序,因为在最初的步骤中我不知道重命名是VS中的一个大问题,我命名了该项目,"stock"但现在我的项目已接近完成,我的主管希望重命名命名空间,BetRates_NS因为它是部署安装项目的名称,
我甚至在我的解决方案和其他依赖项中使用了命名空间名称的web服务引用,基于我以前的经验,在VS中重命名并不容易,
那么some1请给我一步一步的确切步骤来重命名我的解决方案,以便应用程序现在可以顺利运行,并且由于这个原因,可能不会在以后的某个时间点崩溃.
我完全希望在这里提供一些帮助.....比提前...... !!
这是我的解决方案浏览器屏幕:

我是使用Web服务的新手.我被分配了一个任务,我需要在我的Windows应用程序中使用Web服务.这是我将使用的Web服务:https: //api.betfair.com/global/v3/BFGlobalService.wsdl
现在,我已经学会了如何为这项服务添加一个Web引用,但我找不到一个基本的教程,可以帮助我学习如何制作这个Web服务的对象并按我的意愿使用该服务.
基本上,我需要的是在我的表单中从上面的Web服务创建一个对象,并调用它的方法.AC#代码片段会很棒.
谁能给我一些指示?我在Visual Studio 2008和C#Windows应用程序中工作.
我正在创建ac#windows应用程序,使用betfair exchange webservice显示当前的体育市场价格,我使用了
getmarketpricescompressed()
返回如下所示的价格字符串的方法:
106093239~GBP~ACTIVE~0~1~~true~5.0~1343114432333~~N:7337~1~6992.56~2.16~~~false~~~~|2.16~1036.19~L~1~2.14~97.18~L~2~2.12~5.0~L~3~|2.18~467.36~B~1~2.2~34.12~B~2~2.22~162.03~B~3~:414464~2~102181.96~1.86~~~false~~~~|1.85~2900.33~L~1~1.84~1831.59~L~2~1.83~1593.73~L~3~|1.86~58.83~B~1~1.87~1171.77~B~2~1.88~169.15~B~3~
Run Code Online (Sandbox Code Playgroud)
我不知道如何正确解压缩此字符串,因为我现在使用此代码:
GetMarketPricesCompressedReq price_req1 = new GetMarketPricesCompressedReq();
price_req1.header = header2;
price_req1.marketId = marketid_temp;
price_req1.currencyCode = "GBP";
GetMarketPricesCompressedResp price_resp = new GetMarketPricesCompressedResp();
price_resp = bfg2.getMarketPricesCompressed(price_req1);
//MessageBox.Show(price_resp.errorCode.ToString());
//richTextBox1.Text = "";
//richTextBox1.Text = price_resp.marketPrices;
string prices = price_resp.marketPrices;
richTextBox1.Text = price_resp.marketPrices;
string[] ab1 = prices.Split('|');
string[] temp = ab1[1].Split('~');
textBox3.Text = temp[0];
textBox4.Text = temp[4];
textBox5.Text = temp[8];
temp = ab1[2].Split('~');
textBox6.Text = temp[0];
textBox7.Text = temp[4];
textBox8.Text = temp[8];
temp = ab1[3].Split('~');
textBox9.Text = temp[0];
textBox10.Text = …Run Code Online (Sandbox Code Playgroud) private void ViewWinLoaded(object sender, RoutedEventArgs e)
{
var stud = from s in data.Students
select s;
Student[] st=stud.ToArray<Student>();
datagrid.ItemsSource = st;
}
Run Code Online (Sandbox Code Playgroud)
以上是我的C#代码.
<DataGrid x:Name="datagrid" HorizontalAlignment="Left" Height="232" VerticalAlignment="Top" Width="461">
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding Path=StudentID}" ClipboardContentBinding="{x:Null}" Header="StudentID"/>
<DataGridTextColumn Binding="{Binding Path=FirstName}" ClipboardContentBinding="{x:Null}" Header="First Name"/>
<DataGridTextColumn Binding="{Binding Path=LastName}" ClipboardContentBinding="{x:Null}" Header="Last Name"/>
<DataGridTextColumn Binding="{Binding Path=Gender}" ClipboardContentBinding="{x:Null}" Header="Gender"/>
<DataGridTextColumn Binding="{Binding Path=GPA}" ClipboardContentBinding="{x:Null}" Header="GPA"/>
</DataGrid.Columns>
</DataGrid>
Run Code Online (Sandbox Code Playgroud)
我想要实现的是使用我自己的列名,而不是dB中的列名.但是当我运行代码时,它会同时显示我的自定义列和数据库中的列名(级联名称)
c# ×5
betfair ×1
datagridview ×1
linq ×1
renaming ×1
sql ×1
web-services ×1
winforms ×1
wpf ×1