15,888,461 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by Shaik Izaz (Top 27 by date)
Shaik Izaz
11-Nov-16 9:20am
View
Richard MacCutchan, Can you explain me where do I need to set the language or locale to the correct set of character set in order to display them correctly!
Shaik Izaz
28-Jul-15 9:49am
View
I want to retrieve the VM's name and path and then convert them in a CSV file.
Shaik Izaz
27-Jul-15 7:44am
View
Thanks Wes Aday. Reflector works fine..
Shaik Izaz
2-Jul-15 3:46am
View
I tried like this and its solved
private void button1_Click(object sender, EventArgs e)
{
string delimiter = ",";
string tablename = "export";
string filename = ("c:\\izaz\\test.csv");
DataSet dataset = new DataSet();
StreamReader sr = new StreamReader(filename);
dataset.Tables.Add(tablename);
dataset.Tables[tablename].Columns.Add("Name");
dataset.Tables[tablename].Columns.Add("Path");
string allData = sr.ReadToEnd();
string[] rows = allData.Split("\r".ToCharArray());
foreach (string r in rows)
{
string[] items = r.Split(delimiter.ToCharArray());
dataset.Tables[tablename].Rows.Add(items);
}
this.dataGridView1.DataSource = dataset.Tables[0].DefaultView;
}
Shaik Izaz
30-Jun-15 9:37am
View
the reason why i did is because i dont have any idea how to import csv file to DGV and moreover am new to c#
Shaik Izaz
30-Jun-15 8:30am
View
i have change my question and i had wrote my code to import CSVfile to DGV which is not working(actually i took it from the net) because i have no idea how to import csv file into data grid view.
Please check the code in load function - private void Form1_Load(object sender, EventArgs e)
Shaik Izaz
30-Jun-15 8:12am
View
i dont know how to import from csv to DGV can you write me an exam example
Shaik Izaz
30-Jun-15 6:58am
View
you are right! Actually, i was able to import xlsx file to DGV from load function and now i want to import csv file, so that why i just removed the xlsx import code from the load function and posted the full code....
Shaik Izaz
30-Jun-15 5:21am
View
i dint get you
Shaik Izaz
16-Jun-15 11:02am
View
what i mean to say is, Assume if the cell width is 100 and the content width is 50 and when i click on the content it is displying on the textbox but when i click on the remaing empty cell it's not displaying the content in the textbox
Shaik Izaz
11-Jun-15 6:37am
View
Its works like charm!, how to validate if the given Input is not in the database?
Shaik Izaz
3-Jun-15 3:21am
View
i mean i have defined the destination in the code as "C:\psave\New folder\"
Shaik Izaz
2-Jun-15 9:01am
View
Oops! its actualyy FolderBrowserdialog
Shaik Izaz
28-May-15 11:24am
View
How to align the data in cells in middle center
Shaik Izaz
27-May-15 8:39am
View
Yeah, i got it Thank you so much
this works fine:
TxtDob.Format = DateTimePickerFormat.Custom
TxtDob.CustomFormat = "ddMMyyyy"
Shaik Izaz
27-May-15 4:00am
View
Actually i want to save the DOB as 18091989 instead of 18 sep 1989, But i dont know how to do that ?
Shaik Izaz
27-May-15 3:59am
View
Actually i want to save the DOB as 18091989 instead of 18 sep 1989, But i dont know how to do that ?
Shaik Izaz
26-May-15 15:02pm
View
Deleted
Actually i want to save the DOB as 18091989 instead of 18 sep 1989, But i dont know how to do that ?
Shaik Izaz
26-May-15 10:50am
View
Visual studio 2013 and
the error message is: "An unhandled exception of type 'System.FormatException' occurred in mscorlib.dll
Additional information: String was not recognized as a valid DateTime."
Shaik Izaz
26-May-15 10:37am
View
yeah,Its on the same line. Is there any other method to save the DATE as 18091989 instead of 18 SEP 1989
Shaik Izaz
26-May-15 10:30am
View
I tried DateTime.Now also its giving the same error
Shaik Izaz
6-May-15 10:44am
View
Am new to Vb.Net and i wrote this code for to prevent Duplicate ID and even though am able to enter same data in ID field. I don't know what to do now?
Here is my code for to prevent Duplicate entries in TxtID.Text
Public Function DoesIDExist(ByVal id As String) As Boolean
Dim connectionString As String = "provider=microsoft.jet.oledb.4.0; Data Source=C:\psave\New folder\save.xls;Extended Properties=Excel 8.0;"
Dim selectStatement As String = "SELECT COUNT (ID) As CountOfID FROM [edit$] WHERE ID=?"
Dim countOfId As Integer = 0
Using connection As New OleDbConnection(connectionString)
connection.Open()
Using command As New OleDbCommand(selectStatement, connection)
command.Parameters.AddWithValue("?", id)
countOfId = Convert.ToInt32(command.ExecuteScalar)
End Using
End Using
Return countOfId > 0
End Function
Shaik Izaz
6-May-15 9:43am
View
can you please explain what is this SELECT on the sheet?
Shaik Izaz
5-May-15 7:06am
View
when i select a row in DataGridView and click on the delete button its gives me an error message as "Not allowed to change the 'ConnectionString' property. The connection's current state is open" and i don't how to solve this?
Shaik Izaz
5-May-15 5:42am
View
Santosh,
I have added my full code to my question now you can find there what i have tried for delete button.
Shaik Izaz
5-May-15 5:37am
View
Deleted
Imports System.Data.OleDb
Imports System
Imports System.Text
Imports System.IO
Imports System.Net
Imports System.Net.Sockets
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Drawing
Imports System.Threading
Imports Microsoft.VisualBasic
Imports System.Text.RegularExpressions
Imports System.Windows.Forms
Public Class Form1
Private Function vld(ByVal ParamArray ctl() As Object) As Boolean
For i As Integer = 0 To UBound(ctl)
If ctl(i).text = "" Then
ErrorProvider1.SetError(ctl(i), ctl(i).tag)
Return False
Exit For
End If
Next
Return True
End Function
Dim cn As New OleDbConnection
Dim cm As New OleDbCommand
Dim da As OleDbDataAdapter
Dim dt As New DataTable
Private Sub Form1_FormClosing(sender As Object, e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
cn.Close()
End Sub
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
TxtExamtime.Format = DateTimePickerFormat.Custom
TxtExamtime.CustomFormat = "hh:MM tt"
cn.ConnectionString = "provider=microsoft.jet.oledb.4.0; Data Source=C:\psave\New folder\save.xls;Extended Properties=Excel 8.0;"
cn.Open()
FillDataGridView("select ID, Family Name, Given Name, Gender, DOB, Exam Date, Exam Time, Street Name, House Nr, PLZ, City from [edit$]")
End Sub
Private Sub FillDataGridView(ByVal Query As String)
da = New OleDbDataAdapter(Query, cn)
dt.Clear()
da.Fill(dt)
With DataGridView1
.DataSource = dt
.Columns(0).HeaderText = "ID"
.Columns(1).HeaderText = "Family Name"
.Columns(2).HeaderText = "Given Name"
.Columns(3).HeaderText = "Gender"
.Columns(4).HeaderText = "DOB"
.Columns(5).HeaderText = "Exam Date"
.Columns(6).HeaderText = "Exam Time"
.Columns(7).HeaderText = "Street Name"
.Columns(8).HeaderText = "House Nr"
.Columns(9).HeaderText = "PLZ"
.Columns(10).HeaderText = "City"
.Columns(10).AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill
End With
End Sub
Private Sub BtnSave_Click(sender As Object, e As EventArgs) Handles BtnSave.Click
If vld(TxtId, TxtFamilyname, TxtGivenname, TxtGender, TxtDob, TxtExamdate, TxtExamtime, TxtStreet, TxtHouse, TxtPlz, TxtCity) = False Then
Exit Sub
Else
End If
Try
With cm
.Connection = cn
.CommandText = "insert into [edit$]values('" & TxtId.Text & "','" & TxtFamilyname.Text & "','" & TxtGivenname.Text & "','" & TxtGender.Text & "','" & TxtDob.Text & "','" & TxtExamdate.Text & "','" & TxtExamtime.Text & "','" & TxtStreet.Text & "','" & TxtHouse.Text & "','" & TxtPlz.Text & "','" & TxtCity.Text & "' )"
.ExecuteNonQuery()
End With
FillDataGridView("select * from [edit$]")
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Critical, Text)
Return
End Try
MsgBox("Succefully Saved!", MsgBoxStyle.Information, Text)
End Sub
Private Sub BtnDelete_Click(sender As Object, e As EventArgs) Handles BtnDelete.Click
Try
If Not DataGridView1.CurrentRow.IsNewRow Then
With cm
.CommandText = "delete from [edit$] where ID='" & DataGridView1.CurrentRow.Cells(0).Value & "'"
cn.ConnectionString = "provider=microsoft.jet.oledb.4.0; Data Source=C:\psave\New folder\save.xls;Extended Properties=Excel 8.0;"
cn.Open()
.ExecuteNonQuery()
DataGridView1.Rows.Remove(DataGridView1.CurrentRow)
End With
MsgBox("Succesfully Deleted!", MsgBoxStyle.Information, Text)
End If
Cat
Shaik Izaz
5-May-15 5:34am
View
Deleted
Here is my code:
Imports System.Data.OleDb
Imports System
Imports System.Text
Imports System.IO
Imports System.Net
Imports System.Net.Sockets
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Drawing
Imports System.Threading
Imports Microsoft.VisualBasic
Imports System.Text.RegularExpressions
Imports System.Windows.Forms
Public Class Form1
Private Function vld(ByVal ParamArray ctl() As Object) As Boolean
For i As Integer = 0 To UBound(ctl)
If ctl(i).text = "" Then
ErrorProvider1.SetError(ctl(i), ctl(i).tag)
Return False
Exit For
End If
Next
Return True
End Function
Dim cn As New OleDbConnection
Dim cm As New OleDbCommand
Dim da As OleDbDataAdapter
Dim dt As New DataTable
Private Sub Form1_FormClosing(sender As Object, e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
cn.Close()
End Sub
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
TxtExamtime.Format = DateTimePickerFormat.Custom
TxtExamtime.CustomFormat = "hh:MM tt"
cn.ConnectionString = "provider=microsoft.jet.oledb.4.0; Data Source=C:\psave\New folder\save.xls;Extended Properties=Excel 8.0;"
cn.Open()
FillDataGridView("select ID, Family Name, Given Name, Gender, DOB, Exam Date, Exam Time, Street Name, House Nr, PLZ, City from [edit$]")
End Sub
Private Sub FillDataGridView(ByVal Query As String)
da = New OleDbDataAdapter(Query, cn)
dt.Clear()
da.Fill(dt)
With DataGridView1
.DataSource = dt
.Columns(0).HeaderText = "ID"
.Columns(1).HeaderText = "Family Name"
.Columns(2).HeaderText = "Given Name"
.Columns(3).HeaderText = "Gender"
.Columns(4).HeaderText = "DOB"
.Columns(5).HeaderText = "Exam Date"
.Columns(6).HeaderText = "Exam Time"
.Columns(7).HeaderText = "Street Name"
.Columns(8).HeaderText = "House Nr"
.Columns(9).HeaderText = "PLZ"
.Columns(10).HeaderText = "City"
.Columns(10).AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill
End With
End Sub
Private Sub BtnSearch_Click(sender As Object, e As EventArgs) Handles BtnSearch.Click
Try
FillDataGridView("select * from [edit$] where ID='" & TxtId.Text & "'")
TxtFamilyname.Text = dt.Rows(0).Item(1)
TxtGivenname.Text = dt.Rows(0).Item(2)
TxtGender.Text = dt.Rows(0).Item(3)
TxtDob.Text = dt.Rows(0).Item(4)
TxtExamdate.Text = dt.Rows(0).Item(5)
TxtExamtime.Text = dt.Rows(0).Item(6)
TxtStreet.Text = dt.Rows(0).Item(7)
TxtHouse.Text = dt.Rows(0).Item(8)
TxtPlz.Text = dt.Rows(0).Item(9)
TxtCity.Text = dt.Rows(0).Item(10)
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Critical, Text)
End Try
End Sub
Private Sub BtnSave_Click(sender As Object, e As EventArgs) Handles BtnSave.Click
If vld(TxtId, TxtFamilyname, TxtGivenname, TxtGender, TxtDob, TxtExamdate, TxtExamtime, TxtStreet, TxtHouse, TxtPlz, TxtCity) = False Then
Exit Sub
Else
End If
Try
With cm
.Connection = cn
.CommandText = "insert into [edit$]values('" & TxtId.Text & "','" & TxtFamilyname.Text & "','" & TxtGivenname.Text & "','" & TxtGender.Text & "','" & TxtDob.Text & "','" & TxtExamdate.Text & "','" & TxtExamtime.Text & "','" & TxtStreet.Text & "','" & TxtHouse.Text & "','" & TxtPlz.Text & "','" & TxtCity.Text & "' )"
.ExecuteNonQuery()
End With
FillDataGridView("select * from [edit$]")
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Critical, Text)
Return
Show More