Click here to Skip to main content
15,887,175 members
Home / Discussions / WPF
   

WPF

 
AnswerRe: Textbox Undo Pin
SledgeHammer019-May-12 10:14
SledgeHammer019-May-12 10:14 
GeneralRe: Textbox Undo Pin
SledgeHammer019-May-12 10:32
SledgeHammer019-May-12 10:32 
GeneralRe: Textbox Undo Pin
Pete O'Hanlon9-May-12 10:46
mvePete O'Hanlon9-May-12 10:46 
Questionbind data from dattable with datagrid Pin
MemberDotNetting9-May-12 4:29
MemberDotNetting9-May-12 4:29 
QuestionSave DocumentViewer content as MS Word document Pin
sureshb_079-May-12 1:51
professionalsureshb_079-May-12 1:51 
QuestionResize and Edit Text in wpf Pin
NoufMohd8-May-12 1:17
NoufMohd8-May-12 1:17 
AnswerRe: Resize and Edit Text in wpf Pin
Mycroft Holmes8-May-12 12:29
professionalMycroft Holmes8-May-12 12:29 
Questiontry to add data on wpf DataGridColumn Pin
MemberDotNetting7-May-12 10:55
MemberDotNetting7-May-12 10:55 
Hi, I try to import data from an Excel file and display it in a datagrid, the data are email addresses. i want that data will be shown on
XML
<DataGridTemplateColumn Header="Adress" Width="500" IsReadOnly="True">
but when i click on boutton, another DataGridColumn appears with data, but i want that data shown on DataGridColumn="Adress"

code of parse:
C#
public class ExcelParser
    {
        public DataTable GetDataTableExcel(string datasource)
        {

            OleDbConnection theConnection = new OleDbConnection("provider=Microsoft.Jet.OLEDB.4.0;data source=" + datasource + ";Extended Properties=\"Excel 8.0;HDR=NO;IMEX=1;\"");
            theConnection.Open();

            OleDbDataAdapter theDataAdapter = new OleDbDataAdapter("SELECT * FROM [Feuil1$]", theConnection);

            DataTable dt = new DataTable();

            theDataAdapter.Fill(dt);

            return dt;
        }



xaml:
XML
<DataGrid HeadersVisibility="Column" AutoGenerateColumns="True" Height="296" HorizontalAlignment="Left" Margin="23,8,0,0" Name="dgvreceipient" VerticalAlignment="Top" Width="582" MinRowHeight="30" MinWidth="0" DataContext="{StaticResource {x:Static SystemColors.ActiveCaptionBrushKey}}" MinColumnWidth="100" SelectedValuePath="id" ItemsSource="{Binding Customers}"  AlternatingRowBackground="Gainsboro"  AlternationCount="2">
                                <DataGrid.Columns>
                                    <DataGridTemplateColumn Header="Adress" Width="500" IsReadOnly="True">
                                    </DataGridTemplateColumn>
                                    <DataGridTemplateColumn Header="Validate" Width="200" IsReadOnly="True">
                                    </DataGridTemplateColumn>
                                </DataGrid.Columns>



boutton click excel
code behined:
C#
private void btnExcel_Click(object sender, RoutedEventArgs e)
       {

           wpfOpenfiledialog o = new wpfOpenfiledialog();
           o.openfich(1);
           datasource = o.filename;

           ExcelParser exc = new ExcelParser();// class to get data from excel files
           DataTable dt = exc.GetDataTableExcel(datasource);
           //dgvreceipient.ItemsSource = dt.DefaultView;=========>the problem that this ligne will show another column


       }

AnswerRe: try to add data on wpf DataGridColumn Pin
Mycroft Holmes7-May-12 12:26
professionalMycroft Holmes7-May-12 12:26 
AnswerRe: try to add data on wpf DataGridColumn Pin
Wayne Gaylard7-May-12 20:09
professionalWayne Gaylard7-May-12 20:09 
GeneralRe: try to add data on wpf DataGridColumn Pin
MemberDotNetting7-May-12 23:23
MemberDotNetting7-May-12 23:23 
QuestionWPF DataGrid cell click Pin
LAPEC7-May-12 9:27
LAPEC7-May-12 9:27 
Questionwpf ritchbox Pin
MemberDotNetting6-May-12 3:41
MemberDotNetting6-May-12 3:41 
AnswerRe: WPF RichTextBox Pin
Wayne Gaylard6-May-12 21:07
professionalWayne Gaylard6-May-12 21:07 
Questionadd wpf user control Pin
MemberDotNetting4-May-12 22:22
MemberDotNetting4-May-12 22:22 
AnswerRe: add wpf user control Pin
Abhinav S5-May-12 21:40
Abhinav S5-May-12 21:40 
QuestionWPF DataGrid cell click Pin
LAPEC4-May-12 1:06
LAPEC4-May-12 1:06 
AnswerRe: WPF DataGrid cell click Pin
Erik Rude4-May-12 1:31
Erik Rude4-May-12 1:31 
GeneralRe: WPF DataGrid cell click Pin
LAPEC4-May-12 1:51
LAPEC4-May-12 1:51 
GeneralRe: WPF DataGrid cell click Pin
Erik Rude4-May-12 2:46
Erik Rude4-May-12 2:46 
AnswerRe: WPF DataGrid cell click Pin
Jeremy Hutchinson4-May-12 2:46
professionalJeremy Hutchinson4-May-12 2:46 
Questionuser control Pin
MemberDotNetting3-May-12 13:40
MemberDotNetting3-May-12 13:40 
AnswerRe: user control Pin
Jeremy Hutchinson4-May-12 2:34
professionalJeremy Hutchinson4-May-12 2:34 
AnswerRe: user control Pin
Alisaunder6-May-12 2:23
Alisaunder6-May-12 2:23 
QuestionHow to get the value of textbox in ViewModel in WPF - MVVM Pin
Rocky#3-May-12 4:02
Rocky#3-May-12 4:02 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.