15,888,220 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 Member 8010354 (Top 145 by date)
Member 8010354
22-Oct-20 2:14am
View
sorry i didnt understand ur previous comments so posted it again. nvm
Member 8010354
22-Oct-20 1:30am
View
Okay but something is missing with my programming only i guess. Or i'm missing some major point on it. so posted here.
Member 8010354
22-Oct-20 0:46am
View
No what i'm saying is when i tried to copy the files from source location to destination location, it should copy in a proper folder structure (as shown below)
001 - > 1000 files (number of files to be copied is dynamic by providing the user defined value which is already coded)
002 - > 1000 files
003 - > 1000 files
TILL HERE IT IS WORKING
if i try to copy the files to again same location (same files or same source path or anything), it is again creating the folder from 001 instead it should check the folder number already existed and increment it
as per our above example, it should create 004 folder and start copying instead of 001 again.
Member 8010354
5-Oct-20 3:31am
View
thank you
Member 8010354
8-Sep-20 9:50am
View
Thank you sir for your help on this.
Member 8010354
5-Oct-16 9:40am
View
Chat data in mobile. Like mesasging in mesasges or apps and etc.
Member 8010354
22-Sep-16 9:02am
View
but in code 2, he used \t for space and ther for bold, what i have to use?
Member 8010354
7-Sep-16 6:06am
View
I will but at this moment, requesting you to help me at this point.
Member 8010354
7-Sep-16 5:45am
View
Actually what i am requesting is, i got the list of values from the code i have mentioned above (Except List<string> getupdatedetails(int artifactID)). But my manager asked me to ad this and return the values. So how to modify the above code to the way you have shown me?
Member 8010354
7-Sep-16 5:36am
View
Okay. Understood but as i mentioned my code above, now how to add strings to my list?
Like i used foreach loop to get all the values in it. how to link that with myList?
Member 8010354
7-Sep-16 5:19am
View
I want to return the LIST. If that is the case, how i have to formate the code and what i have to write near return?
Member 8010354
7-Sep-16 5:18am
View
When i used
return List<string>;
i am getting an error stating List<string> is a type but used as a variable.
Member 8010354
7-Sep-16 5:17am
View
That means i have to write
}
return List<int>; ?
Member 8010354
25-Aug-16 5:02am
View
Yeah for that i am going to add + ";"; so it will separate but i foubd that the code is not able to move forward near LIST<int32> multiobject = ((List<int32>)favouritefieldname.value);
Member 8010354
25-Aug-16 4:34am
View
No it is not working.
Member 8010354
25-Aug-16 3:42am
View
I am getting error at this line.
EmailAddress += employee.ArtifactID + favouriteDocumentsField.Name + "Object: " + index, docID);
Exactly at: index, docID);
Member 8010354
23-Aug-16 6:53am
View
List<int32> multiObject = ((List<int32>)favoriteDocumentsField.Value);
foreach (int docID in multiObject) {
emailAddress += docID.Artifact.Fields[0].Value.ToString() + ";";
}
In the above code, i am getting an error near Artifact inside loop stating int does not contain a definition for Artifact.
Member 8010354
9-Aug-16 5:49am
View
Now how to deal with this? Can you please help me with this?
Member 8010354
9-Aug-16 5:40am
View
STRBODY += "<span style="font-weight:bold">TaskID:</span>" + a[GUIDCollection.TASK_TASKID_GUID].ToString() + ""<span style="font-weight:bold">Category</span>"+"CategoryName: " + Category.Name.ToString() + " " + Status.Name.ToString();
Member 8010354
9-Aug-16 5:40am
View
STRBODY += "<span style="font-weight:bold">TaskID:</span>" + a[GUIDCollection.TASK_TASKID_GUID].ToString() + ""<span style="font-weight:bold">Category</span>"+"CategoryName: " + Category.Name.ToString() + " " + Status.Name.ToString();
Member 8010354
9-Aug-16 5:09am
View
I have changed my question.
Member 8010354
18-Jul-16 7:56am
View
I have a field called STATUS. It's choices are IN PROGRESS, O HOLD, QC PENDING and COMPLETE.
Member 8010354
18-Jul-16 7:35am
View
I am programming using APIs.
Member 8010354
18-Jul-16 5:56am
View
Thank you so much. It's working fine but there is a small problem. In field name1 and fieldname2, I am using the a field where it is having the multiple choices. I want the selected choice value to be displayed but when i use the fieldname there, i am not getting the field name and selected choice value.
Member 8010354
18-Jul-16 5:22am
View
In the line string results = sb.ToString();, i am getting an error near results variable stating "A local variable results cannot be declared in this scope because it could give a different meaning for results which is already used in a parent or current scope to denote something else."
Can i use any other word?
Member 8010354
13-Jul-16 12:07pm
View
I have a column name but it is not displaying in LOG. Only value is displaying.
Member 8010354
11-Jul-16 1:56am
View
Can you elaborate please. I didn't undrestand.
Member 8010354
11-Jul-16 1:15am
View
Okay, actually i am creating a presaveevent handler using APIs in web application (KCURA-Relativity). So i have created the customised application in that and whenever user creates a new task (EX: Like a student registration form), it hsould genarate the unique value. In that point i took SQL into the picture.
Member 8010354
11-Jul-16 1:15am
View
Okay, actually i am creating a presaveevent handler using APIs in web application (KCURA-Relativity). So i have created the customised application in that and whenever user creates a new task (EX: Like a student registration form), it hsould genarate the unique value. In that point i took SQL into the picture. In the link you refered, it is like while creating a table we are setting it as auto increment value. how to use this?
Member 8010354
8-Jul-16 4:49am
View
Can anyone help me on this how to resolve?
Member 8010354
7-Jul-16 3:38am
View
I have posted the line where i am struck. Please let me know if this is hard to understand and estimate to provide solution will share the complete code.
Member 8010354
7-Jul-16 2:51am
View
I didn't understand. Can you please elaborate this point?
Member 8010354
28-Jun-16 2:51am
View
Actually i have a file where the date field will have multiple dates. So if it is in dd/mm, i have to change it to mm/dd. If it is in mm/dd, i have to change it to dd/mm. So that is what my task is.
Member 8010354
2-Jun-16 4:11am
View
I tried using DateTime nowdate = DateTime.Now.ToString("dd/MM/yyyy h:mm tt");
but it giving error as it couldn't the format.
But when i take the string
string currenttime =datetime.now.tostring("dd/MM/yyyy h:mm t");
Now how to use this string in the program?
Member 8010354
31-May-16 22:46pm
View
But here i have to the field ID (100010101) and track get it's input value. How to do that?
Member 8010354
31-May-16 9:54am
View
A user will enter into particular field everytime. So whenever it sends an email, it should take the value (Emaild ID) from that textbox.
Member 8010354
26-May-16 7:26am
View
Actually i have to comapre the GUID inside the list is equal to field collection
if it is matching, then getting the value
Member 8010354
26-May-16 6:02am
View
continuation.........
foreach(var item in fc)
{
}
Member 8010354
26-May-16 6:01am
View
Hi,
Thanks for your explanation and it really helped me a lot. With that i am having an another doubt. That is, I have created a List
List<string, int=""> ArtifactIDList = new List<string,int>();
And i have created another object for field collection: FieldCollection fc=(FieldCollection)this.ActveArtifact.Fields;
Now how i have to compare the current field to list? Sorry if my question is incomplete.
Member 8010354
25-May-16 22:15pm
View
Thank you :)
Member 8010354
14-Apr-16 5:10am
View
Desktop application means a windows application?
Member 8010354
14-Apr-16 4:34am
View
@Richard: Can you please suggest me which way to go.
Member 8010354
14-Apr-16 3:50am
View
Below is my program:
public partial class DriveThreshold : System.Web.UI.Page
{
class Report
{
public static void Main()
{
DriveInfo[] allDrives = DriveInfo.GetDrives();
foreach (DriveInfo d in allDrives)
{
Console.WriteLine("Drive {0}", d.Name);
Console.WriteLine(" Drive type: {0}", d.DriveType);
if (d.IsReady == true)
{
Console.WriteLine(" Volume label: {0}", d.VolumeLabel);
Console.WriteLine(" File system: {0}", d.DriveFormat);
Console.WriteLine(
" Available space to current user:{0, 15} bytes",
d.AvailableFreeSpace);
Console.WriteLine(
" Total available space: {0, 15} bytes",
d.TotalFreeSpace);
Console.WriteLine(
" Total size of drive: {0, 15} bytes ",
d.TotalSize);
}
}
}
}
In ASPX page:
<div>
<asp:Button ID="DriveInfor" runat="server" Text="Get the Drive Info" OnClick="DriveInfo_Click" />
</div>
Member 8010354
14-Apr-16 3:39am
View
Actually it's remote machine. So first i want get the MY COMPUTER drive details in my laptop so later i can figure out how to get the same for mapped drives.
Member 8010354
14-Apr-16 3:31am
View
Hi, Thank you providing it. I tried this code but when i execute, i see blank screen in output. Can you let me know where did i missed like i'm not getting any error as well.
Member 8010354
14-Apr-16 3:01am
View
Normally in My Computer, will have
1) Hard Disk Drives: C, D and etc.
2) Devices with Removable Storage: Floppy Disk Drive, DVD Drive and etc.
3) Network Location: Whatever the networks we mapped will be seen here.
So, what i want is For those, drives there is Total size and Free space which i can see after opening a my computer but i want to automate that. can anyone please hemp me on this?
Member 8010354
13-Apr-16 23:49pm
View
Actually the drivers are mapped to MY COMPUTER in my laptop. I want to read the NAME, TOTAL SIZE and FREE SPACE from it. Isn't it possible?
Member 8010354
13-Apr-16 23:48pm
View
Actually, that drives are mapped to My Computer in my laptop. So from there i have to read the drive name, total size and free space.
So it's not possible?
Member 8010354
11-Apr-16 3:14am
View
Sorry. I didn;t get you clearly. I'm new to this API concept and unaware of websites with API's and not with API's. Can you explain me clearly?
Member 8010354
30-Mar-16 7:50am
View
Didn;t get you.
Member 8010354
28-Mar-16 8:33am
View
Can anyone help me on this?
Member 8010354
22-Mar-16 8:14am
View
I tried logging into website so i felt like it works with javascript and below is my code:
<html>
<title>Ikariam Autologin</title>
</head>
<body>
<form id="loginForm" name="loginForm" method="post" action="http:www.gmail.com">
<select name="uni_url" id="logServer" class="validate[required]">
<option class="" value="ID@gmail.com" fbUrl="" cookieName="" >
Test_en
</option>
</select>
<input id="loginName" name="name" type="text" value="PlayersName" class="" />
<input id="loginPassword" name="password" type="password" value="Site_Password" class="" />
<input type="hidden" id="loginKid" name="kid" value=""/>
</form>
<script>document.loginForm.submit();</script>
I'm not getting any error but i'm getting a combobox, texbox1 (with text inside "PlayersName"), textbox2 (dotsssss).
Member 8010354
22-Mar-16 6:38am
View
I tried logging into website so i felt like it works with javascript and below is my code:
<html>
<title>Ikariam Autologin</title>
</head>
<body>
<form id="loginForm" name="loginForm" method="post" action="http:www.gmail.com">
<select name="uni_url" id="logServer" class="validate[required]">
<option class="" value="ID@gmail.com" fbUrl="" cookieName="" >
Test_en
</option>
</select>
<input id="loginName" name="name" type="text" value="PlayersName" class="" />
<input id="loginPassword" name="password" type="password" value="Site_Password" class="" />
<input type="hidden" id="loginKid" name="kid" value=""/>
</form>
<script>document.loginForm.submit();</script>
I'm not getting any error but i'm getting a combobox, texbox1 (with text inside "PlayersName"), textbox2 (dotsssss).
Member 8010354
15-Mar-16 4:40am
View
We don't have access to SQL Database. Right now we have only website name and credentials.
Member 8010354
29-Feb-16 8:56am
View
Hi,
I have changed the code as mentioned below. Please let me know is everything correct as of now i can't the code so asking you to check it with patience:
private void button2_Click(object sender, EventArgs e)
{
//ServiceController[] se = ServiceController.GetDevices();
// ServiceController[] services = ServiceController.GetServices();
ServiceController[] services = ServiceController.GetServices("RCSTVMAN05");
int i = 0;
foreach (ServiceController service in services)
{
dataGridView1.Rows.Add();
//service.ServiceName = "ALG"; //Finding the paticular service
dataGridView1.Rows[i].Cells["dgvcServiceName"].Value = Convert.ToString(service.ServiceName);
dataGridView1.Rows[i].Cells["dgvcStatus"].Value = Convert.ToString(service.Status);
dataGridView1.Rows[i].Cells["dgvcDescription"].Value = Convert.ToString(service.DisplayName);
i += 1;
}
// i += 1; //If i put this inside the loop, the servicename ALG repeats
}
private void button1_Click(string host, string username, string password)
{
string ns = @"C:\........Desktop";
string query = "File name";
ConnectionOptions options = new ConnectionOptions();
if (!string.IsNullOrEmpty(username))
{
options.Username = "DOMAIN\USERNAME";
options.Password = "Password";
}
ManagementScope scope =
new ManagementScope(string.Format(@"\\{0}\{1}", host, ns), options);
scope.Connect();
ManagementObjectSearcher searcher =
new ManagementObjectSearcher(scope, new ObjectQuery(query));
ManagementObjectCollection retObjectCollection = searcher.Get();
foreach (ManagementObject mo in retObjectCollection)
{
Console.WriteLine(mo.GetText(TextFormat.Mof));
}
}
Member 8010354
29-Feb-16 8:53am
View
Deleted
Hi,
I have changed the code as mentioned below. Please let me know is everything correct as of now i can't the code so asking you to check it with patience:
private void button1_Click(string host, string username, string password)
{
string ns = @"F:\CachedProfiles\vatluri\Desktop";
string query = "Relativity Services"; //Relativity Services
ConnectionOptions options = new ConnectionOptions();
if (!string.IsNullOrEmpty(username))
{
options.Username = "ATDRUK\vatluri";
options.Password = "d@mpRain76";
}
ManagementScope scope =
new ManagementScope(string.Format(@"\\{0}\{1}", host, ns), options);
scope.Connect();
ManagementObjectSearcher searcher =
new ManagementObjectSearcher(scope, new ObjectQuery(query));
ManagementObjectCollection retObjectCollection = searcher.Get();
foreach (ManagementObject mo in retObjectCollection)
{
Console.WriteLine(mo.GetText(TextFormat.Mof));
}
}
private void button2_Click(object sender, EventArgs e)
{
//ServiceController[] se = ServiceController.GetDevices();
// ServiceController[] services = ServiceController.GetServices();
ServiceController[] services = ServiceController.GetServices("RCSTVMAN05");
int i = 0;
foreach (ServiceController service in services)
{
dataGridView1.Rows.Add();
//service.ServiceName = "ALG"; //Finding the paticular service
dataGridView1.Rows[i].Cells["dgvcServiceName"].Value = Convert.ToString(service.ServiceName);
dataGridView1.Rows[i].Cells["dgvcStatus"].Value = Convert.ToString(service.Status);
dataGridView1.Rows[i].Cells["dgvcDescription"].Value = Convert.ToString(service.DisplayName);
i += 1;
}
// i += 1; //If i put this inside the loop, the servicename ALG repeats
}
Member 8010354
26-Feb-16 7:23am
View
Actually we have server's services placed on a desktop as a console application (With a briefcase icon). If i open that, i do have particular services and it's status.
Member 8010354
26-Feb-16 4:30am
View
Can anyone help me telling that how to get the services from the .msc file which is placed on the desktop instead of getting the services from service.msc (own computer).
Member 8010354
26-Feb-16 2:37am
View
I gave the remote machine name and user,password for login. Now i would like to get the services from AAAAAA.msc which is placed on that machine's desktop .
As per my code, the code whic you shared, i'm getting the services from services.msc but how can i get the services status from the service which is palced in the desktop.
Member 8010354
25-Feb-16 8:56am
View
I have visited that. Can you please help me on remotely connecting.... i didn't get exactly on that
Member 8010354
25-Feb-16 6:02am
View
Yeah now i'm able to get the services of my computer. Can you please tell me how to fetch services from console applications remotely?
Member 8010354
25-Feb-16 4:40am
View
Hi,
I have added the columns and now i'm able to get the services from my Task Manager. But i want to login to other machine and fetch the services from Console Application which is located at that machine. Below is my code for fetching services from my system:
private void button1_Click(object sender, EventArgs e)
{
ServiceController[] se = ServiceController.GetDevices();
ServiceController[] services = ServiceController.GetServices();
int i = 0;
foreach (ServiceController service in services)
{
dataGridView1.Rows.Add();
dataGridView1.Rows[i].Cells["dgvcServiceName"].Value = Convert.ToString(service.ServiceName);
dataGridView1.Rows[i].Cells["dgvcStatus"].Value = Convert.ToString(service.Status);
dataGridView1.Rows[i].Cells["dgvcDescription"].Value = Convert.ToString(service.DisplayName);
i += 1;
}
}
Can you please help me to retrive the services status from console applications?
Member 8010354
24-Feb-16 8:36am
View
Hi,
I have tried and now i'm able to get the service for my computer. Now how can i get the services from other machine (Where i used to connect remotely from my laptop). On that remote machine, I do have services icon on desktop. When i open that, i do have services for many servers. So can you help me achieving this?
Below is my code for fetching the services from my system:
private void button1_Click(object sender, EventArgs e)
{
ServiceController[] se = ServiceController.GetDevices();
ServiceController[] services = ServiceController.GetServices();
int i = 0;
foreach (ServiceController service in services)
{
dataGridView1.Rows.Add();
dataGridView1.Rows[i].Cells["dgvcServiceName"].Value = Convert.ToString(service.ServiceName);
dataGridView1.Rows[i].Cells["dgvcStatus"].Value = Convert.ToString(service.Status);
dataGridView1.Rows[i].Cells["dgvcDescription"].Value = Convert.ToString(service.DisplayName);
i += 1;
}
Member 8010354
24-Feb-16 8:36am
View
Hi,
I have tried and now i'm able to get the service for my computer. Now how can i get the services from other machine (Where i used to connect remotely from my laptop). On that remote machine, I do have services icon on desktop. When i open that, i do have services for many servers. So can you help me achieving this?
Below is my code for fetching the services from my system:
private void button1_Click(object sender, EventArgs e)
{
ServiceController[] se = ServiceController.GetDevices();
ServiceController[] services = ServiceController.GetServices();
int i = 0;
foreach (ServiceController service in services)
{
dataGridView1.Rows.Add();
dataGridView1.Rows[i].Cells["dgvcServiceName"].Value = Convert.ToString(service.ServiceName);
dataGridView1.Rows[i].Cells["dgvcStatus"].Value = Convert.ToString(service.Status);
dataGridView1.Rows[i].Cells["dgvcDescription"].Value = Convert.ToString(service.DisplayName);
i += 1;
}
Member 8010354
24-Feb-16 2:24am
View
Hi,
I have tried and now i'm able to get the service for my computer. Now how can i get the services from other machine (Where i used to connect remotely from my laptop). On that remote machine, I do have services icon on desktop. When i open that, i do have services for many servers. So can you help me achieving this?
Below is my code for fetching the services from my system:
private void button1_Click(object sender, EventArgs e)
{
ServiceController[] se = ServiceController.GetDevices();
ServiceController[] services = ServiceController.GetServices();
int i = 0;
foreach (ServiceController service in services)
{
dataGridView1.Rows.Add();
service.ServiceName = "ALG"; //Finding the paticular service
dataGridView1.Rows[i].Cells["dgvcServiceName"].Value = Convert.ToString(service.ServiceName);
dataGridView1.Rows[i].Cells["dgvcStatus"].Value = Convert.ToString(service.Status);
dataGridView1.Rows[i].Cells["dgvcDescription"].Value = Convert.ToString(service.DisplayName);
i += 1;
}
Member 8010354
23-Feb-16 4:27am
View
Deleted
Can you please tell how to add columns as i'm new to datagridview functionalities.
Member 8010354
22-Feb-16 8:36am
View
Can you please tell me.
Member 8010354
22-Feb-16 2:22am
View
Actually, i would like to get the service and it's status into my datagridview on a button click.
Below is the code:
private void button1_Click(object sender, EventArgs e)
{
ServiceController[] se = ServiceController.GetDevices();
ServiceController[] services = ServiceController.GetServices();
int i = 0;
foreach (ServiceController service in services)
{
dataGridView1.Rows.Add();
dataGridView1.Rows[i].Cells["dgvcServiceName"].Value = Convert.ToString(service.ServiceName);
dataGridView1.Rows[i].Cells["dgvcStatus"].Value = Convert.ToString(service.Status);
i += 1;
}
}
I'm getting error near: dataGridView1.Rows.Add(); Error:No row can be added to datagridview control that does ot have columns. columns must be added first.
Member 8010354
16-Feb-16 11:51am
View
Sorry i didn't get you. Can you please explain once again in brief.
Member 8010354
16-Feb-16 10:49am
View
Yeah i did that. In my file, i do have only 3 records where second record is having blank value in Date column. When i debugg, for the first line, the row count is 1. when it comes to second line, it's showing the rowcount as -26. I didn't get what to do. Can you please help me achieving this?
Member 8010354
16-Feb-16 8:23am
View
If i do this, i'm getting 1 record less in the grid. Like if i have 10 records in the file, i'm getting only 9 in the grid.
Member 8010354
15-Feb-16 6:54am
View
I'm getting error in this line:
dataGridView1.Rows[RowCount - 1].Cells[cmbIdentity.Text].Value += column[i].ToString();
Index was out of range. Must be non-negative less than the size of collection.
Member 8010354
15-Feb-16 6:20am
View
Can you please help me now as i have used the IsNull
Empty but the error is different
Member 8010354
15-Feb-16 6:06am
View
Now i have improved my question. Can you please look into that?
Member 8010354
15-Feb-16 5:25am
View
I tried using IsNullorEmpty property
if (RowCount != 0)
{
string[] column = strfile[RowCount].Split('þ');
for (int i = 1; i < column.Length - 1; i++)
{
if (cmbColumnCombo.SelectedIndex == ((i - 1) / 2))
{
if (!string.IsNullOrEmpty(column[i].ToString()) && column[i].ToString() != "\u0014")
{
dataGridView1.Rows.Add();
DateTime Time = Convert.ToDateTime(column[i].ToString());
dataGridView1.Rows[RowCount - 1].Cells[txtColumnName.Text.Replace(" ", "")].Value = Time.ToString("HH:mm:ss");
dataGridView1.Rows[RowCount - 1].Cells[cmbColumnCombo.Text].Value = Time.ToString("dd/MM/yyyy");
//dataGridView1.Rows[RowCount - 1].Cells[cmbColumn1.Text].Value += column[i].ToString();
}
}
}
for (int i = 1; i < column.Length - 1; i++)
{
if (cmbIdentity.SelectedIndex == ((i - 1) / 2))
{
if (!string.IsNullOrEmpty(column[i].ToString()) && column[i].ToString() != "\u0014")
{
dataGridView1.Rows[RowCount - 1].Cells[cmbIdentity.Text].Value += column[i].ToString();
}
}
}
Member 8010354
15-Feb-16 5:24am
View
Deleted
Yeah i used nullable Datetime like:
if (RowCount != 0)
{
string[] column = strfile[RowCount].Split('þ');
for (int i = 1; i < column.Length - 1; i++)
{
if (cmbColumnCombo.SelectedIndex == ((i - 1) / 2))
{
if (!string.IsNullOrEmpty(column[i].ToString()) && column[i].ToString() != "\u0014")
{
dataGridView1.Rows.Add();
DateTime Time = Convert.ToDateTime(column[i].ToString());
dataGridView1.Rows[RowCount - 1].Cells[txtColumnName.Text.Replace(" ", "")].Value = Time.ToString("HH:mm:ss");
dataGridView1.Rows[RowCount - 1].Cells[cmbColumnCombo.Text].Value = Time.ToString("dd/MM/yyyy");
//dataGridView1.Rows[RowCount - 1].Cells[cmbColumn1.Text].Value += column[i].ToString();
}
}
}
for (int i = 1; i < column.Length - 1; i++)
{
if (cmbIdentity.SelectedIndex == ((i - 1) / 2))
{
if (!string.IsNullOrEmpty(column[i].ToString()) && column[i].ToString() != "\u0014")
{
dataGridView1.Rows[RowCount - 1].Cells[cmbIdentity.Text].Value += column[i].ToString();
}
}
}
But still it's giving error.
Member 8010354
15-Feb-16 4:40am
View
Yeah you are right! But it's giving the error.
Member 8010354
15-Feb-16 4:24am
View
Can you help how to program to accept the blank values....
Member 8010354
15-Feb-16 4:04am
View
Actually there is no fixed value to add. If there is any blank value, it should just show the blank value.
Member 8010354
4-Feb-16 9:25am
View
I shared.
Member 8010354
4-Feb-16 8:20am
View
The changes are not saving. I'm able to save the file (same file) but the changes are not saving. Okay i removed the commented code.
Member 8010354
4-Feb-16 4:02am
View
No, now it's not giving 30. It's giving the replaced value count of only first page. But i want the count for all pages.
Member 8010354
4-Feb-16 2:48am
View
Actually my file contains 100 records. As per the requirement, i want only 30 records to display in datagridview (in each page) so i declared a variable with value 30.
So i changed my code:
Instead of //if ((column[i]).Contains(StaticVar.Find) != null)
i replaced if ((column[i]).Contains(StaticVar.Find) == true)
Now, i'm getting the correct replaced value in message box. The problem here is, it's showing the replaced value of the current page. I want the replaced value count of all pages.
Is there any alternative? Shall i provide my code for reading a file?
Member 8010354
3-Feb-16 4:25am
View
Actually i'm getting the message box but everytime it's showing the replaced count is 30 irrespective of the repalced count.
Member 8010354
2-Feb-16 4:20am
View
I stuck in another functionality here. After clicking on find and replace, i'm getting a message box. After closing the window also i'm getting the same message box (Everytime). How to resolve this?
Member 8010354
2-Feb-16 4:10am
View
Hey i improved my question. Please let me know if it's unclear.
Member 8010354
1-Feb-16 8:34am
View
When i'm trying to take the new file, the records in datagridview are empty. Again i need to open new instance to get the file loaded.
Member 8010354
1-Feb-16 7:06am
View
I got it by this way:
if (isFindAndReplace)
{
MessageBox.Show(string.Format("No: of values replaced is: {0}", replaced));
}
Member 8010354
1-Feb-16 7:06am
View
I got it by this way:
if (isFindAndReplace)
{
MessageBox.Show(string.Format("No: of values replaced is: {0}", replaced));
}
Member 8010354
1-Feb-16 2:41am
View
In this line, i'm replacing my text.
if (StaticVar.FnR == true && index == StaticVar.colindx)
{
if ((column[i]).Contains(StaticVar.Find) != null)
dataGridView1.Rows[rowindex].Cells[index].Value = column[i].Replace(StaticVar.Find, StaticVar.Replace);
}
so i would like to add message boc after replacing the values.
Member 8010354
31-Jan-16 23:53pm
View
If i take that in datable, it'll some time to load the file. so i'm reading th efile.
Member 8010354
29-Jan-16 8:07am
View
Working on it.
Member 8010354
29-Jan-16 8:07am
View
Thank you:)
Member 8010354
28-Jan-16 5:10am
View
Hi, I have updated my question. Please let me know if anything i can change to be more specific. I will try.
Member 8010354
27-Jan-16 2:19am
View
Can you please explain clearly? Nevermind, i'm new to .net
Member 8010354
25-Jan-16 5:14am
View
Yeah i couldn't able to give you clear answer as i copied this code from internet. Can i get the alternative code format apart from this?
Member 8010354
25-Jan-16 4:55am
View
Didn't get you
Member 8010354
25-Jan-16 4:52am
View
Hi, I have used System.Globalization.CultureInfo.CurrentCulture but the result is still same.
Member 8010354
25-Jan-16 2:27am
View
Hi, sorry for the delay response. It's just a variable i have declared and i'm getting the problem especially when we are having 12 and 13 in the date.
(Ex: 12/13/2015). It's unable to figure out the month and date.
Member 8010354
22-Jan-16 9:15am
View
DateTime.ParseExact() in C#
ParseExact method will allow you to specify the exact format of your date string to use for parsing. It is good to use this if your string is always in the same format. The format of the string representation must match the specified format exactly.
string iString = "2005-05-05 22:12 PM";
DateTime oDate = DateTime.ParseExact(iString, "yyyy-MM-dd HH:mm tt",null);
MessageBox.Show(oDate.ToString());
I saw it in google and used that format.
Member 8010354
22-Jan-16 8:09am
View
Actually, on a button click another form opens. Where i will select the DateTime columns. After selecting the column and click on OK, the date format should change in the datagridview in form1. So i used SelectedIndex.
Though i use selected value, the result is same.
Member 8010354
22-Jan-16 8:05am
View
After using CulturelInfo.InvariantCuluture also, the issue is same.
Member 8010354
22-Jan-16 8:03am
View
Even though, i'm getting the same issue.
Member 8010354
20-Jan-16 5:42am
View
Yeah i changed the code now.
private void button3_Click(object sender, EventArgs e)
{
Date_Format df = new Date_Format();
df.cmbColumns.DataSource = cmbList;
df.ShowDialog();
string data = "";
foreach (DataGridViewRow row in dataGridView1.Rows)
{
data = Convert.ToString(row.Cells["Sent Date"].Value);
var result = String.Format("{0:'dd/MM/yyyy hh:MM:tt'}", data);
}
Now i'm not getting error but there is no change on date format column on selection of that column
Member 8010354
20-Jan-16 5:32am
View
Now i'm not getting any error but the date format is not changing in the datagridview.
private void button3_Click(object sender, EventArgs e)
{
Date_Format df = new Date_Format();
df.cmbColumns.DataSource = cmbList;
df.ShowDialog();
string data = "";
foreach (DataGridViewRow row in dataGridView1.Rows)
{
data = Convert.ToString(row.Cells["Sent Date"].Value);
var result = String.Format("{0:'dd/MM/yyyy hh:MM:tt'}", data);
}
Member 8010354
20-Jan-16 5:17am
View
Now i changed the code as you told which is updated below:
private void button3_Click(object sender, EventArgs e)
{
Date_Format df = new Date_Format();
df.cmbColumns.DataSource = cmbList;
df.ShowDialog();
foreach (DataGridViewRow row in dataGridView1.Rows)
{
DateTime date = (DateTime)(row.Cells["Sent Date"].Value);
string formattedDate = date.ToString("dd/MM/yyyy hh:mm:tt");
}
}
Now it's giving InvalidCastException was unhandled
Member 8010354
20-Jan-16 5:04am
View
Still it's giving the same error near data
Error is: FormatExceptionwasnhandled
Additional Information: Input string is not in a correct format –
Member 8010354
19-Jan-16 23:40pm
View
Yeah i understood your point and i got it. i should be using rowcount instead of i.
Member 8010354
19-Jan-16 2:05am
View
I tried in multiple ways but still i'm seeing the error. Please help me with any alternative
Member 8010354
18-Jan-16 7:49am
View
Actually, while debugging i observed that CODE: DateTime Time = Convert.ToDateTime(column[i]);
dataGridView1.Rows[i].Cells[txtColumnName.Text.Replace(" ", "")].Value = Time.ToString("HH:mm:ss");
Initially Time is taking
Date = {1/1/0001 12:00:00 AM} value and later on it's reading the dates in file but the DATE in the file is 5/4/2009 3:45 PM.
After cursor moving to the second line, then the TIME is having 5/4/2009 3:45 PM date.
Member 8010354
18-Jan-16 5:14am
View
Yeah it's a valid one.
Drpdownbox: No: of columns displayed (Have to select DateTime column)
TextBox: Need to enter new column value
DataGridView: It should display as a 2 columns.
Member 8010354
18-Jan-16 2:10am
View
Hi, Yeah what you understood is correct in terms of Data Loading and Gridview loading multiple time. Whenever i click NEXT button, the loads and will fetch the rest of the documents (Which is continuous from the previous page line).
Here's the LoadPage code:
public void LoadPage(string Format, bool isFindAndReplace = false)
{
int startRec;
int endRec;
if (currentPage == PageCount)
{
endRec = maxRec;
}
else
{
endRec = pageSize * currentPage;
}
dataGridView1.Rows.Clear();
if (recNo == 0)
{
dataGridView1.Columns.Clear();
}
int rowindex = 0;
startRec = recNo;
for (int RowCount = startRec; RowCount <= endRec; RowCount++)
{
if (datfile[RowCount].ToString() != "")
{
if (RowCount == 0)
{
string[] column = datfile[RowCount].Split('þ');
for (int i = 0; i < column.Length - 1; i++)
{
if (column[i].ToString() != "" && column[i].ToString() != "\u0014")
{
DataGridViewTextBoxColumn dgvtxtcountry = new DataGridViewTextBoxColumn();
dgvtxtcountry.HeaderText = column[i].ToString();
dgvtxtcountry.Name = column[i].ToString();
dataGridView1.Columns.Add(dgvtxtcountry);
cmbList.Add(column[i]);
i += 1;
}
}
}
if (RowCount != 0)
{
dataGridView1.Rows.Add();
string[] column = datfile[RowCount].Split('þ');
int index = 0;
for (int i = 1; i < column.Length - 1; i++)
{
if (column[i].ToString() != "\u0014")
{
if (i == 3)
{
dataGridView1.Rows[rowindex].Cells[index].Value = Convert.ToDateTime(column[i]).ToString(Format);
}
else
{
if (toFind != "" && toReplace != "")
{
if (column[i].Contains(toFind))
{
//dataGridView1.Rows[i].Cells[f.cmbColumnCombo.Text].Value = dataGridView1.Rows[i].Cells[f.cmbColumnCombo.Text].Value.ToString()
column[i] = column[i].Replace(toFind, toReplace);
dataGridView1.Rows[rowindex].Cells[index].Value = column[i].Trim('þ');
}
else
{
dataGridView1.Rows[rowindex].Cells[index].Value = column[i].Trim('þ');
}
}
else
{
dataGridView1.Rows[rowindex].Cells[index].Value = column[i].Trim('þ');
}
}
index += 1;
i += 1;
}
}
rowindex += 1;
}
}
recNo += 1;
}
}
Member 8010354
14-Jan-16 8:24am
View
BRWSE button code where i read the file into DataGridView:
private void button1_Click(object sender, EventArgs e)
{
OpenFileDialog openFileDialog1 = new OpenFileDialog();
openFileDialog1.InitialDirectory = "Desktop";
openFileDialog1.Filter = "dat files (*.DAT)|*.DAT|All files (*.*)|*.*";
openFileDialog1.FilterIndex = 2;
openFileDialog1.RestoreDirectory = true;
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
try
{
FileName = openFileDialog1.FileName;
string text = System.IO.File.ReadAllText(FileName);
datfile = text.Split(new string[] { "\r\n", "\n" }, StringSplitOptions.None);
//Added on 2015-12-02
maxRec = datfile.Length - 1;
PageCount = maxRec / pageSize;
LoadPage(MyFOrmat);
}
catch (Exception ex)
{
MessageBox.Show("Error: Could not read file from disk. Original error: " + ex.Message);
}
}
}
Member 8010354
14-Jan-16 6:55am
View
public string toFind = ""; public string toReplace = "";
private void btnFindandReplace_Click(object sender, EventArgs e)
{
Form2 f = new Form2();
f.cmbColumnCombo.DataSource = cmbList;
f.ShowDialog();
toFind = f.txtfind.Text;
toReplace = f.txtreplace.Text;
for (int i = 0; i <= dataGridView1.Rows.Count - 1; i++)
{
if (dataGridView1.Rows[i].Cells[f.cmbColumnCombo.Text].Value.ToString().ToLower().Contains(f.txtfind.Text.ToLower()))
{
if (!string.IsNullOrEmpty(f.txtfind.Text))
{
dataGridView1.Rows[i].Cells[f.cmbColumnCombo.Text].Value = dataGridView1.Rows[i].Cells[f.cmbColumnCombo.Text].Value.ToString().Replace(f.txtfind.Text, f.txtreplace.Text);
}
}
}
}
Member 8010354
14-Jan-16 6:03am
View
Thank you. But i'm working on windows application and i'm not fetching data from any database. I'm reading a file and displaying in datagridview.
In this case, how should i save it? shall i post my code so it'll be helpful?
Member 8010354
12-Jan-16 6:22am
View
It's not working int he sense: the functionality is applying to only one page not for all pages
Member 8010354
12-Jan-16 5:26am
View
So plz let me know where to code
Member 8010354
12-Jan-16 5:26am
View
Actually it's not about error. When i try using the existing variables to apply the same functionality to all pages, it's not working.
Member 8010354
8-Jan-16 6:36am
View
I can't do automerge as i will use that functionality based on the requriement only.
Member 8010354
8-Jan-16 5:36am
View
actually i didn't get it. i'm still trying
Member 8010354
8-Jan-16 5:12am
View
Yeah i'm getting same functionality so i posted all things in one. so if i get hint for one i could apply the same to rest.
Member 8010354
8-Jan-16 2:44am
View
Button click event code for Merge in another form:
DataGridViewTextBoxColumn dgvctime = new DataGridViewTextBoxColumn();
dgvctime.Name = cmbColumn1.Text;
dgvctime.HeaderText = cmbColumn1.Text;
dataGridView1.Columns.Add(dgvctime);
for (int i = 0; i <= dgvMerge.Rows.Count - 1; i++)
{
dataGridView1.Rows.Add();
dataGridView1.Rows[i].Cells[cmbColumn1.Text].Value = dgvMerge.Rows[i].Cells[cmbColumn1.Text].Value + " " + dgvMerge.Rows[i].Cells[cmbColumn2.Text].Value;
}
}
Member 8010354
8-Jan-16 2:03am
View
I posted in that code itself (down to the page). I'm posting again
Thanks in advacne
CODE FOR MERGING TWO COLUMNS:
private void btnMerge_Click(object sender, EventArgs e)
{
frmMerge fs = new frmMerge(dataGridView1);
fs.cmbColumn1.DataSource = cmbList;
for (int i = 0; i <= cmbList.Count - 1; i++)
{
fs.cmbColumn2.Items.Add(cmbList[i]);
}
fs.ShowDialog();
}
Member 8010354
7-Jan-16 9:02am
View
Didn't get you exactly
Member 8010354
7-Jan-16 7:25am
View
Yeah what you told is correct. It's reading from array. Can you give me more hint of sourcing it through programmatically if you got the code cause i'm new learner to this .net and the project is already starteda and i took it from middle.
The array is:
String[] datfile;
Member 8010354
7-Jan-16 6:55am
View
I tried adding. But i'm missing some logic. Can you please suggest me where? Below is the code for NEXT button:
private void btnNext_Click(object sender, EventArgs e)
{
currentPage += 1;
if (currentPage > PageCount)
{
currentPage = PageCount;
//Check if you are already at the last page.
if (recNo == maxRec)
{
MessageBox.Show("You are at the Last Page!");
return;
}
}
LoadPage(MyFOrmat);
}
Member 8010354
7-Jan-16 6:09am
View
When i'm doing Find and Replace, it's working for only current page not for all pages. I want it in one go like once i do find and replace, it should find the word in all pages and replace in all pages.
Member 8010354
7-Jan-16 5:01am
View
I got it by using this code
if (!string.IsNullOrEmpty(f.txtfind.Text))
{
dataGridView1.Rows[i].Cells[f.cmbColumnCombo.Text].Value = dataGridView1.Rows[i].Cells[f.cmbColumnCombo.Text].Value.ToString().Replace(f.txtfind.Text, f.txtreplace.Text);
Thanks.
Member 8010354
7-Jan-16 4:38am
View
Don't mind. I didn't understand the code.
Member 8010354
7-Jan-16 4:12am
View
I have used the else statement and set the dialogue property to OK but still i face the same issue.
Member 8010354
7-Jan-16 2:57am
View
Form2 f = new Form2();
f.cmbColumnCombo.DataSource = cmbList;
f.ShowDialog();
for (int i = 0; i <= dataGridView1.Rows.Count - 1; i++)
{
if (dataGridView1.Rows[i].Cells[f.cmbColumnCombo.Text].Value.ToString().ToLower().Contains(f.txtfind.Text.ToLower()))
{
//dataGridView1.Rows[i].Cells[f.cmbColumnCombo.Text].Value = dataGridView1.Rows[i].Cells[f.cmbColumnCombo.Text].Value.ToString().ToLower().Replace(f.txtfind.Text.ToLower(), f.txtreplace.Text);
//bulidDataRow(i);
dataGridView1.Rows[i].Cells[f.cmbColumnCombo.Text].Value = dataGridView1.Rows[i].Cells[f.cmbColumnCombo.Text].Value.ToString().Replace(f.txtfind.Text, f.txtreplace.Text);
bulidDataRow(i);
}
}
Member 8010354
6-Jan-16 5:25am
View
Code moved to question
Member 8010354
6-Jan-16 4:45am
View
Thanks a lot. Your solution helped me and the point where i strucked is True or False near StreamWriter.
Once again thank you:).
Member 8010354
6-Jan-16 4:25am
View
Below is the code for methods:
public void SaveDatArr(String[] datfile)
{
SaveFileDialog saveFileDialog1 = new SaveFileDialog();
String StrRebuild = "";
for (int j = 0; j <= datfile.Length - 1; j++)
{
StrRebuild += datfile[j];
StrRebuild += Environment.NewLine;
}
saveFileDialog1.Filter = "dat files (*.DAT)|*.DAT|All files (*.*)|*.*";
saveFileDialog1.FilterIndex = 2;
saveFileDialog1.RestoreDirectory = true;
if (saveFileDialog1.ShowDialog() == DialogResult.OK)
{
StreamWriter sw = new StreamWriter(saveFileDialog1.FileName, true);
sw.WriteLine(StrRebuild);
sw.Flush();
sw.Close();
}
}
Member 8010354
6-Jan-16 3:10am
View
My apologies for posting a question in unclear format. But what you understood is right!
If i'm trying to save a file with the same filename (The file which i have browsed to view in gridview). It's appending the records. How to resolve it?
Member 8010354
5-Jan-16 8:15am
View
Sorry. I think you took it in a different way. I didn't mean to write the whole code. I just asked the way of programming as you suggested like Looping and replacing with "". Sorry for the way i asked. thank you i will try with that logic.
Member 8010354
5-Jan-16 8:08am
View
I'm not fetching any data from SQL server. I'm just reading a file and displaying in DataGridView where i have many columns. I'm fetching the columns into another form and spliting the Date Time column (1) to Date and Time (2).
Now, the future dates functionality comes into picture. On a button click, i want to blank the future dates. Can you please suggest me the code ASAP as i have to submit it now.
Member 8010354
5-Jan-16 6:57am
View
I mean only the value should get blank not the entire row. If i change the color it'll will be invisible but i have to load this data to another workspace where the value should not load. That's the reason i asked for blanking out the cell value which is having future date.
Member 8010354
24-Dec-15 4:53am
View
What's this CultureInfo and DateTimeStyles?
Member 8010354
16-Dec-15 6:41am
View
Yeah this works when we are adding columns manually. But in my case, I'm reading a file which contains headers and it's values.
The initial line is Header and rest of the lines are it's values. So how i solve in this case?
Member 8010354
16-Dec-15 4:54am
View
And moreover, the code which i entered
dataGridView1.Columns["Sent Date"].DefaultCellStyle.Format = "dd/MM/yyyy";
is not working. After i click on that button, nothing is happening.
Member 8010354
16-Dec-15 4:54am
View
Deleted
And moreover, the code which i entered
dataGridView1.Columns["Sent Date"].DefaultCellStyle.Format = "dd/MM/yyyy";
is not working. After i click on that button, nothing is happening.
Member 8010354
16-Dec-15 4:52am
View
Okay that's perfect. If i have multiple columns with Date, then what i have to do?
Ex: Sent Date, Last Modified Date, Received Date.
Member 8010354
16-Dec-15 4:01am
View
Actually i didn't start coding for that task as i'm completly new to C#.net.
I just fetched the data from a file and reading into datagridview where one of the column is having the date, so i want to change that format.
Is it possible for converting only that column values (Date format) in the grid?
Member 8010354
16-Dec-15 2:49am
View
Thank you so much for reply. But i should have multiple options to change the date format irrespective of the format i have. Is it possible?
Ex: Whether i have dd/mm/yy or mm/dd/yy or yy/mm/dd,
I would like to open another form on a button click where i should have all types of formats to convert.
Show More