Click here to Skip to main content
15,891,943 members
Everything / Programming Languages / C# 3.0

C# 3.0

C#3.0

Great Reads

by Jeffrey Walton
Import and export Cryptographic Keys in PKCS#8 and X.509 formats, using Crypto++, C#, and Java.
by Daniel Vaughan
Calcium provides much of what one needs to rapidly build a multifaceted and sophisticated modular application. Includes a host of modules and services, and an infrastructure that is ready to use in your next application.
by Dark Daskin
Article describes how to build an assembly that exposes functions to unmanaged code without C++/CLI
by Sacha Barber
It would probably be like Cinch, an MVVM framework for WPF.

Latest Articles

by Shivprasad koirala
Design Pattern FAQ - Interview Questions (Quick Reference)
by Harsha T, Amarnath S, S Mahesh Reddy
A simple viewer of images stored in the DICOM 3.0 File Format (C#). The file should have raw pixel data, uncompressed. Window Level functionality is also provided.
by AlexeyYakovlev
This paper demonstrates a technique of building Sprache parsers using grammar inheritance.
by Randy Kroeger
This article provides an example on how you can change application configuration settings within an existing ClickOnce publish, update the manifest files, followed by using the Mage utility for updating the manifest using the existing cert file.

All Articles

Sort by Updated

C# 3.0 

30 Mar 2024 by Pete O'Hanlon
To add to the excellent answers here. In order to learn about working with images in C#, you should check out Christian Graus' articles on image processing in C#. The first one is Image Processing for Dummies with C# and GDI+ Part 1 - Per Pixel...
29 Mar 2024 by Andre Oosthuizen
When you modify an image loaded directly from a file or resource, you need to create a new Bitmap object and make changes to that new object, apply your changes, and then assign the modified Bitmap back to your 'PictureBox.Image' property - int...
29 Mar 2024 by OriginalGriff
If I try your code with one of my own images and add a counter and supporting code: Color NewColor = Color.FromArgb(1, 1, 155, 100); Color co; int wid = pictureBox1.Width; int hig =...
29 Mar 2024 by Engineer khalid
Hello pictureBox1 has imge of lamp in the center with size of 100x100 pixel using co = ((Bitmap)pictureBox1.Image).GetPixel(3, 3) which seems to be the back ground color i want to change that color to NewColor but it did not work,i found all...
22 Mar 2024 by OriginalGriff
To add to what Graeme has said, a better solution is to use DateTime.TryParseExact Method (System) | Microsoft Learn[^] instead - that way you can spot errors instead of your app crashing if the data isn't in the format you expect for some...
22 Mar 2024 by Engineer khalid
Hello i want to convert string str to DateTime,str="2024/22/03" SYSTEMFORMAT of my computer is m/d/yyyy i want the Date_1 in format yyyy/MM/dd Date_1 = Convert.ToDateTime(str, "yyyy/MM/dd"); What I have tried: str = "2024/12/03"; Date_1 =...
22 Mar 2024 by Graeme_Grant
DateTime.ParseExact Method (System) | Microsoft Learn[^] will do what you want: string str = "2024/22/03"; // Parse the string into a DateTime object with the specified format DateTime dateTime = DateTime.ParseExact(str, "yyyy/dd/MM", null); ...
22 Feb 2024 by Maciej Los
If you're looking for a way to transfer data between forms, please, read, these excellent tricks: Transferring information between two forms, Part 1: Parent to Child[^] Transferring information between two forms, Part 2: Child to Parent[^]...
18 Feb 2024 by Jo_vb.net
There are some articles about sharing data here at CP. This is one of them: Sharing data among Windows Forms[^]
18 Feb 2024 by Engineer khalid
Hello Two forms in program ,private textBox1 in Form1 .I need the value of that textBox1 in Form2. I do not want to set variable as Public static string in Form1 equal to textBox1.Text,looking for better solution What I have tried: //in Form1...
15 Feb 2024 by Richard Deeming
The error message is slightly confusing, but once you see it, the problem is obvious: Quote: Please specify one of either an InputStream or a FilePath to be PUT as an S3 object. The error is telling you that you have specified both an...
15 Feb 2024 by itsathere
File.WriteAllBytes("D:/" + model.FileBase.FileName, model.FileBase.Data); byte[] bytes = Convert.FromBase64String(model.file); using (var inputStream = new MemoryStream(model.FileBase.Data)) { ...
17 Jan 2024 by Graeme_Grant
Best place to ask is Google Search: list of social media sites[^]. The 3rd search result yielded this: List of social networking services - Wikipedia[^]
17 Jan 2024 by daniel wakeley
So I'm working on an adult content blocker. Most solutions on the market including things like OpenDNS, safe search, and web applications that block urls and sites do not properly work. There is always a work around. There are higher end...
4 Jan 2024 by Dave Kreskowiak
Restart should quit the current instance of the app and start a new instance, but sometimes the shutdown doesn't work as expected because of something your app is doing. I have no ideas what that is, but the workaround is really simple. Call: ...
4 Jan 2024 by Engineer khalid
i want to close the current run of a program and start it again i used System.Windows.Forms.Application.Restart(); i got two run of program ! What I have tried: System.Windows.Forms.Application.Restart();
6 Dec 2023 by Maciej Los
Quote: i have seen some names but not all Please, refer to the MSDN documentation: Directory.GetFiles Method (System.IO) | Microsoft Learn[^] As you can see, there is a few overloaded methods. Maybe you need to use that one which uses...
6 Dec 2023 by Richard Deeming
First problem: don't call GetFiles twice. If you want the number of files that were returned, look at the Length property on the array you've already stored. Second problem: the Length property doesn't have any arguments. Which means your call...
6 Dec 2023 by Engineer khalid
i have several files in folder ,i want to see all extract there name by code i use n=Directory.GetFiles(CurrentDirectory).Length(CurrentDir); then i used a for loop to see their names ,i have seen some names but not all What I have tried: ...
8 Nov 2023 by CHill60
That is not a program it is a Class. Assuming you are just trying to create a Console program it could be as simple as using System; public class Program { public static void Main() { // put some code here } } Again, assuming you...
7 Nov 2023 by Lyrica Sugiyama
using System; namespace BankAccountManagemnetSystem { public class BankAccount { private decimal balance; private int amount; public BankAccount(decimal initialBalance) { balance =...
30 Oct 2023 by Engineer khalid
I failed to reference the correct DLL for MS Word. When I made a reference to Com/ Microsoft.Office.Interop.Word 15.0 object Library 8.6, Visual Studio also made a reference to Microsoft.Office.Core. I used vstudio 2019 community. Details about...
30 Oct 2023 by Maxim Kartavenkov
This error displays that loaded library for the specified COM object which is referenced by your application does not contains the interface which you required. If you using the some standard .NET libraries for accessing office objects you...
25 Sep 2023 by Ralf Meier
Your question and the "code" you have posted are not matching together. Perhaps, before asking a question, you should read how to ask a question ... When consulting my glass-orb I used the Search-Function of this Forum for Button - perhaps there...
25 Sep 2023 by OriginalGriff
This is a meaningless "question": a "3D button" doesn't exist, all you get is an impression of 3D action via shading slight movement. So what you think an array of buttons is going to add to the question is anybody's guess. This is not a good...
13 Jul 2023 by Member 12702056
What is the difference between char zero and normal zero in c++? especially i mean in c++for example,char x=0;int x=0;and char x='0'or just like '0'what is the difference between all of them?what is the exact meaning of them?Please,help me :)What I have tried:I know that...
18 May 2023 by Pawan Kiran
Hi All,I don't want to show any row in highlighted mode.by default it should be in highlight mode for the top row of Datagridview.i tried Datagridview1.ClearSelection(); but still the top row is displayed in highlighted mode.here is my codeprivate void FillGridView() ...
18 May 2023 by Member 16008766
But caution as other events can occur after Load... such as _RowPrePaint so a currentcell = nothing in those events may resolve your issue as well.
18 Mar 2023 by mohamed246
You Can Extend the TextBox Class , Add BorderColor proberty and override the WndProc method as it shown in that code, Note that you must set the BorderStyle to FixedSingle. public class ExTextBox : System.Windows.Forms.TextBox { ...
18 Mar 2023 by Pawan Kiran
Hi all,I need to change the Textbox Border Color at the time of Textbox Click.If any body knows how to do this then please let me know.I tried it in form_load event but it applies for all textboxes in the form.I want it in one particular Textbox click.Regards,Pawan.
4 Mar 2023 by SRIRAM 2
Dear All,I am using HTML file control and HTML image control in .aspx page (for uploading image and showing on web page). It is working fine, but I am unable to get that uploaded image file path and file name in .aspx.cs page. Also, I need to know how to save selected image in MS...
3 Mar 2023 by Istehak Ahmad
c# how to see ListBox selected Item row number? What I have tried: c# how to see ListBox selected Item row number?
3 Mar 2023 by OriginalGriff
From your other questions, it's likely you are using a WinForms listbox - in which case just use the SelectedIndex (or SelectedIndices) property of the Listbox. Do note that this refers to the order as displayed in the ListBox, not the order in...
2 Mar 2023 by Istehak Ahmad
string item0 = listBox4.GetItemText(listBox4.Items[0]); textBox1.Text= item0; if (listBox6.Items.Contains(item0)) { pictureBox3.Visible = true; ...
2 Mar 2023 by Istehak Ahmad
string item0 = listBox4.GetItemText(listBox4.Items[0]); if (listBox6.Items.Contains(item0)) { pictureBox3.Visible = true; pictureBox4.Visible = false; } ...
2 Mar 2023 by RickZeeland
You could use listBox2.Items.FindByText(), see example here: Listbox Selection in C#.net[^]
1 Mar 2023 by OriginalGriff
The Items property returns a collection (ListBox.Items Property (System.Windows.Forms) | Microsoft Learn[^]), item is a string. Even if you used a comparison operator such as "==" instead of and assignment "=" it wouldn't work! You need to think...
1 Mar 2023 by Istehak Ahmad
C# listbox1 all items have pictureBox, pictureBox1 should be enable if listbox1 first item is matched with listbox2 items. pictureBox2 should be enable if listbox1 2nd item is matched with listbox2 items What I have tried: I am new and looking...
1 Mar 2023 by OriginalGriff
Quote: I am new and looking for code. It doesn't work like that. While we are more than willing to help those that are stuck, that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this,...
15 Feb 2023 by prathameshpitale
Hi, I need to Execute some block of code only if Code is running in Debug Mode.I dont know how to achieve this, Can you illustrate it ??I googled Many pages but found none useful.Prathamesh
15 Feb 2023 by Member 15914308
Noting the dates of the above replies, it may be a bit late for the OP ;-) But in the hope that it may help others, here is what I found in 2023:...
28 Jan 2023 by Jayadheer Reddy
Hi Guys, I have a table which looks like this 1 | Transport | Bus-Service | ..... 2 | Transport | Tain-Service | ...... 3 | Facilities | Bus-Service..| ... 4 | Facilities | Rail-service..| .....and my objective is to displayTransport ...
7 Jan 2023 by Manidas Payyoli
Hi i am learning blazor and am stuck in some point.I have an edit form having functionality to add multiple image for a record.How can i merge list of images and other data as a single paylod. i have rough code with me but dont know how to...
7 Jan 2023 by Graeme_Grant
This Google search has a number of solutions: upload files with blazor - Google Search[^] Here is one: * Upload files with drag & drop or paste from clipboard in Blazor - Meziantou's blog[^]
6 Jan 2023 by BillWoodruff
The simple answer is that the need to access a private member is a mistake, a design flaw. One strategy used to allow different levels of access to Classes' internal methods/state is dealing with security issues at an OS level (groups,...
6 Jan 2023 by bsb25
How do we access non public members?I have a object called doseSuggestiions which has a non public member called as "frequencies"I want to access the same.Plz help me in this
31 Dec 2022 by Graeme_Grant
As I am unfamiliar with how to print a Datagrid using ProtDocument, I did a quick google search: c# print datagridview using printdocument - Google[^]and there were lots of solutions - first 3 results: * C# DataGridView Printing[^] * How To...
19 Dec 2022 by omid amin javaheri
salam Ali this is your answer have good time
15 Dec 2022 by Steven Villarreal
I am writing a program in C# that will extract five files from a .DAT file. I have the original file along with their extensions which are a .pdf, .tif, .txt, and two .docx files saved on my computer for reference. My question is, how am I...
15 Dec 2022 by Dave Kreskowiak
If your code is creating this .DAT file, you can NOT just copy the bytes from your source files and append them to the .DAT file. You need to keep track of how many bytes are written to the .DAT file for each "file" you add to it. You're tracking...
17 Nov 2022 by sunnykvinod
hi guys.my web application has authentication and authorization.I want to open forgot password page form login page. But it is not allowing me to access the page.I gave access to the page using below code. ...
26 Oct 2022 by Ahmed Salah Oct2022
namespace program { class program { static void Main(string[] args) { int[] grade = new int[10]; int[] cre = new int[10]; string[] gpa = new string[10]; double[] gs = new...
26 Oct 2022 by George Swan
What I would suggest is to use generic lists rather than arrays as the list size is not a fixed value so you avoid the empty array cell value problem. Rather than have multiple if then else statements in your code you can calculate the results...
25 Oct 2022 by Graeme_Grant
You need to add a test statement in your second loop... for (int i = 0; i
20 Oct 2022 by tarek shawki
Hello Guys , i'm new to programming and developing application so please take it easy one me if you please . i'm developing application that will connect to a weigh indicator via RS232 serial port , i have established a connection between the...
16 Sep 2022 by neha427
Hi,I would like to display a checkbox in an RDLC report indicated that the valuefrom the database (true/false). There is no checkbox available from thereport designer.Do anyone have any ideas on how best to solve this problem?Thanks in advance
16 Sep 2022 by paulberth
(change the textbox’s font to Wingdings2) =IIf( Fields!MyBooleanField.Value, Chr(82), Chr(163)) thanks for this, its work
18 Aug 2022 by Manidas Payyoli
Hi i am checking one lengthy if condition but am getting this error-Operator '&&' cannot be applied to operands of type 'int' and 'bool'.What is the problem? What I have tried: if ((IndexSearchCOB == 0 && IndexSearchOH == 0 && IndexSearchPCSA...
18 Aug 2022 by Egr k
one dimension delegate is fine in my code ,however when i extend it to two dimension i have got error What I have tried: delegate void SampleDelegate(object sender, MouseEventArgs e); SampleDelegate[][] MyFun = { ...
18 Aug 2022 by jsc42
This is not another solution, it is a comment on Solution 2 but I am adding it in a 'Solution' section because I don't think that I can format code in a 'Comment' section. The most compact (in source code, but not in runtime efficiency) way of...
17 Aug 2022 by Richard Deeming
Quote: IndexSearchCOB = 0 && IndexSearchOH > 0 You need a second = here: IndexSearchCOB == 0 && IndexSearchOH > 0 NB: Your statement can be dramatically simplified without changing the meaning: if (IndexSearchCOB >= 0 && IndexSearchOH >=...
12 Aug 2022 by Alan N
Your 2D array is called either a jagged array or alternatively an array of arrays. Here are some initialisation examples for string arrays. See my comments on the jaggedArray example to understand why it's initialisation cannot be as simple as...
12 Aug 2022 by Richard MacCutchan
Are you the same person that posted Need to subscripe mousedown[^]? The two names look suspiciously similar. If you are, then please delete the duplicate userid. But either way the original question suggested what you need to do.
27 Jul 2022 by sevenbell
How can I remove /delete empty row of a datagridview?
27 Jul 2022 by Southmountain
now I find a neat solution: yourDataGridView.AllowUserToAddRows = false;
21 Jul 2022 by Denesh Neupane
i am trying to read the sd card data which is connected to renesas microcintroller. microcontroller is serially connected with FT232RL module. i am using c# apps to read the data but the data is not received in application. i need help! What I...
21 Jul 2022 by Gerry Schmitz
I don't know where you're getting your code from; I used the vendor's code. https://ftdichip.com/wp-content/uploads/2020/08/D2XX_Programmers_GuideFT_000071.pdf // 1. This sample shows how to read all the data currently available. FT_HANDLE...
13 Jul 2022 by sharmarun
can any one send me a link for understanding "How to make sms application in Web "
12 Jul 2022 by Kunjammu
allTopics = await _dbContext.Collection.Find(x => x.ParentContentIds.Contains(String.Join(",", filter.SolutionIds))).ToListAsync(); Here ParentContentIds and filter.SolutionIds are List But even if having data, no data returned. I want...
12 Jul 2022 by Richard Deeming
Difficult to say without seeing the structure of your model, but perhaps something like this? allTopics = await _dbContext.Collection .Where(x => x.ParentContentIds.Any(p => filter.SolutionIds.Contains(p))) .ToListAsync();
12 Jul 2022 by OriginalGriff
string.Join converts a collection of strings into a single string, separated by one or more of the separator string you specify. So if filter.SolutionIds contains three strings "1", "2", and "3", then String.Join(",", filter.SolutionIds) will...
23 Jun 2022 by Abdul Majid 2022
i have a windows form application in which I have a Datagridview. I have linked the Datagridview to a sql Server database. I added a timer for my application to update the datagridview with new records from the database. Now I would like to...
22 Jun 2022 by Member 15583139
Quote: "Welcome" is displayed, but it is necessary before that Click "Advanced" and "Agree to risk and continue" Where and what to connect to get rid of the message Caution: Ahead is a possible security threat
17 Jun 2022 by Member 8287316
Hi guys hope someone can convert this piece of code to C# code :static char s0, s1, s2, s3, s4, s5; // Seedstatic char byteConv (char byte, int byteNum){ static char b, shift; static char i, c; switch (byteNum) { case 0 : c = byte ^ s0; break; case 1 : c = byte ^...
16 Jun 2022 by n.deny
i want to re-arrange the id number after delete the selected row from the datagridview . if id was 1,2,3,4,5 then after delete the third row output should be 1,2,3,4. i dont have idea about it please help!! What I have tried: private void...
16 Jun 2022 by n.deny
thankyou @originalGriff for your comment .As, you said it wasnt changed in id column .so, i duplicate the id with another heading and its working.
16 Jun 2022 by Mohammed Arif 2022
I Have a List. it's Mother List Bag It's Contain more Children's List inside so I need To create More Instance Based On Number of Child List Inside Mother List. Ref snap Below. I Can't Create Using Loop . Any suggestion What I have...
15 Jun 2022 by OriginalGriff
It's not very clear from your vague description exactly what you are trying to do, but it looks like you are trying to "flatten" a List of Lists into a single collection. If so, then try this: Enumerable.SelectMany Method (System.Linq) |...
14 Jun 2022 by OriginalGriff
Don't. ID's should not have to be sequential, they should be unique. If you change ID values, then any data which was not removed relating to the old ID will be associated with the new instead, and that can cause massive data integrity problems...
6 Jun 2022 by Member 15663501
Because You are Refering Mutiple Table As reference.i has faced same issues.resolved,Mutiple TABLE REFERING
4 Apr 2022 by rafid rahman
I want to integrate the existing attendance system with my software interface in which i will receive all the employee attendance information. But i can't be able to find out a way how to do the integration. What I have tried: I have gone...
4 Apr 2022 by CPallini
The manufacturer (ZKTeco) provides various SDKs. That's the way to go.
6 Mar 2022 by OriginalGriff
You have other problems you need to sort out first: 1) Don't use the DataGridView itself directly unless you really have to - use the underlying DataSource instead. That way, you get access to the actual data fields more easily. 2) Your column...
6 Mar 2022 by n.deny
i want to save the datagridview data to CSV but dont know the idea to chang the date format from 2022/03/07 00:00 to 2022/03/07. What I have tried: private void button7_Click(object sender, EventArgs e) { try { ...
28 Feb 2022 by Luc Pattyn
Hi, SendMessage waits for a reply by the addressee, which is OK for most purposes; however it is the wrong choice for sending a "stop all activity" command, as the destination will obey and not reply, causing your sending app to hang forever. ...
28 Feb 2022 by n.deny
i want to clicked the save button of another application from my c# application.if there is data in that application then save dialogbox will appear while in absence of data message box will appear.After i want to give the filename as date and...
27 Feb 2022 by Denesh Neupane
i want to click the abcd button of an application from my c# application and also click the ok button of pop-up messagebox appears when abcd button is clicked. but when i click the abcd button from my application then My c# application stop...
27 Feb 2022 by M Imran Ansari
Check the article to achieve through Windows APIs: Using Windows APIs from C#, again![^]
27 Feb 2022 by User 7427435
How can I can get the index of an array element? Is there a method available?What I have tried:Nothing.
29 Jan 2022 by _Asif_
System memory is a bit complex and virtual memories make it more complex. For the start you can use below code to get Installed Memory. For my laptop it is showing 16 GB which is correct. var gcMemoryInfo = GC.GetGCMemoryInfo(); var...
28 Jan 2022 by Engineer khalid
Hello I have stored a bigbitmap.bmp in memory (assume its size 640x4800), I want to see part of it in k loop where k
13 Jan 2022 by Member 15498681
i got data from PDF 01-jan-2019 in this format but i want to convert date in 01-01-2019 in asp.net C# What I have tried: i thing only way to do that compare the string and set predefined number
13 Jan 2022 by OriginalGriff
Take the date as a string in the current text format: "01-jan-2019" and use TryParseExact to convert it to a DateTime value. You can then use ToString to output it in any format you want: Formatting a DateTime for display - format string...
29 Dec 2021 by ahmedbelal
How to convert Roman numerals to Integer in C# without any built-in function and step by step What I have tried: How to convert Roman numerals to Integer in C# without any built-in function and step by step
29 Dec 2021 by Maciej Los
Have you seen this: c# - Roman numerals to integers - Stack Overflow[^]?
28 Dec 2021 by Patrice T
Quote: How to convert Roman numerals to Integer in C# without any built-in function and step by step 1) study how roman numerals are built Roman numerals - Wikipedia[^] 2) Get many samples and solve them by hand, you are following rules, they...
28 Dec 2021 by Dave Kreskowiak
Coming up with the "step-by-step" is your job. That's the point of the exercise. You have to think about the problem and come up with the algorithm that solves it. Do it on paper, one step at a time, and document precisely what you're doing at...
28 Dec 2021 by Gerry Schmitz
Add the following to your dictionary; then proceed from the left; matching the first 2 chars; if not a match, the first 1 char. Remove the 2 or 1 leading matched chars; repeat the lookup. Add the dictionaries values to get the final result. CM...
27 Dec 2021 by OriginalGriff
While we are more than willing to help those that are stuck, that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for...