C# is an object-oriented programming language created in conjunction with Microsoft’s .NET framework. Compilation is usually done into the Microsoft Intermediate Language (MSIL), which is then JIT-compiled to native code (and cached) during execution in the Common Language Runtime (CLR).

Share tech news, updates, or what's on your mind.

Sign up to Post

I have come to a dead end, I am trying to do as follows
1. receive via Serial Port (named: MsComm1) data
2. the data i receive I want to store it in a buffer, and when a specific case happens I want the data to be shown into a textbox.

(my code used to work in Visual Basic, BUT, now i need to do it in C#).

my current issue is that, I am loosing the data, i do receive and recognize it in my Switch routine, but when i try and display it , my buffer is empty...

static string msg = "";
        public void DataReceive()
            int buffCount;
            String ReceivedData = String.Empty;
            int xi = 100000;
            int i = 0;
            int iub;
            string c;
            string recmsg;
            List<string> Msgs = new List<string>();
            Int32 cnt = 0;

                if (!MsComm1.IsOpen == true)

                    cnt = MsComm1.BytesToRead;
                    byte[] buffer = new byte[cnt];
                    if (cnt > 0)
                        Array.Resize<byte>(ref buffer, cnt+1);
                        MsComm1.Read(buffer, 0, cnt);
                        iub = buffer.Length - 1;

                        for (i = 0; i < iub; i++)

Open in new window

Salesforce Made Easy to Use
Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Hello Experts,

Is there any way within an ASP.NET Core MVC Web Appplication to retrieve data from a PowerShell Script, call a PowerShell Script or retrieve the following information below from the PowerShell Script that I have now?

PowerShell Code:
$bios = Get-WmiObject -Class Win32_BIOS
$cpu  = Get-WmiObject -Class Win32_Processor
$os   = Get-WmiObject -Class Win32_OperatingSystem
$sys  = Get-WmiObject -Class Win32_ComputerSystem
$key  = Get-WmiObject -Class SoftwareLicensingService

$sysProperties = [ordered]@{
	'-- PC --' = ''

        'Domain' = $sys.domain
	'PC Name' = $os.pscomputername
	'User Name' = $sys.UserName

	'-- Model --' = ''

	'Manufacturer' = $sys.manufacturer
	'Model' = $sys.model
	'Serial Number' = $bios.serialnumber
	'Product Number' = $sys.SystemSKUNumber

	'-- Hardware --' = ''

	'Processor' = $cpu.Name
	'Installed RAM' = $sys.totalphysicalmemory / 1GB -as [int]

	'-- OS --' = ''

	'Edition' = $os.caption
	'OS System Type' = $os.osarchitecture
	'OS Build' = $os.buildnumber
        'Product Key' =$key.OA3xOriginalProductKey;
$Separator = '-' * ($sysProperties.Values | Measure-Object -Property Length -Maximum).Maximum
@($sysProperties.Keys) | Where-Object {$_ -like '--*'} | ForEach-Object {$sysProperties[$_] = $Separator}

Open in new window

I am new to Xamarin, C# and SQLite. I found a article https://msdn.microsoft.com/en-us/magazine/mt736454.aspx.
Basically I can get the Android code to work properly but I can't get the IOS code to work.
The emulator starts on the mac but then I get the error that you see in the attached file. I understand that it is due to something not getting passed but don't understand what that is.

Any help would be greatly appreciated so that I can move forward with this project.

Thanks in advance
Txtinput.Text is where I want to output 6 digits of random number when a button is clicked. What is the code to do that?
i have changed an old  windows application made in VB to website in c#.Both are referring a same vb dll code.for that particular dll code, Both the applications show sometimes the out of string space error and we are fine with that. But the freqency of out of string space error is very high for website comparatively of windows application. This code generates a report. so it first write the data from database into an xml file and then generates a word file. while writing that xml,this error comes.
I have checked for the same object ,in windows application it took 6-7hours but finally it gives the report. While in website in around 1 hour it gives out of string space error.
What cold be the reason ?
I've successfully used this code to ingest a pipe delimited file into a string array.
How should I change it to ingest it into a decimal array?
For example adding a D suffix to every number, so C# doesn't confuse a decimal and a double?  I may have overlooked other issues.

string[,] AryXref = new string[6, 100];                    
using (StreamReader csv_file = File.OpenText(XrefFile))

                        while (csv_file.Peek() >= 0)

                            // read and add a line
                            string RICandSuffix = csv_file.ReadLine();
                            if (RICandSuffix.Trim() != "" && RICandSuffix.Substring(0, 1) != ";" )

                                RICandSuffix = RICandSuffix.Replace("\t", "");
                                RICandSuffix = RICandSuffix.Replace("\"", "");

                                string[] ArySplit = RICandSuffix.Split('|');
                                AryXref[0, XrefCt] = ArySplit[0].Trim();//DsCode
                                AryXref[1, XrefCt] = ArySplit[1].Trim();//Filename
                                AryXref[2, XrefCt] = ArySplit[2].Trim();//Index Code
                                AryXref[3, XrefCt] = ArySplit[3].Trim();//Column Number
                                AryXref[4, XrefCt] = ArySplit[4].Trim();//Datatype
                                AryXref[5, XrefCt] = ArySplit[5].Trim();//Index Name

Open in new window

An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

var ist = EAdapter.Insert(txtclgname.Text, txtErlno.Text, drpsem.SelectedItem.Text,
                       drpEdu.SelectedItem.Text, drpBranch.SelectedItem.Text,
                    drpPassyear.SelectedItem.Text, float.Parse(txtCGPA.Text), drpreqskill.SelectedItem.Text, txtExSkill.Text, resume);
I am a C#.NET developer but have not yet touched Core. I am in the midst of a job changes and have some time, which I could put int learning the basics of .NET Core.

Is that a good idea?

I do not se many member in the few .NET Code topic areas, unless I am missing the bigger TA's.

I seek a list of 20 most important design patterns in computing today.

I am a C#.NET Full Stack developer, so that may bias which patters are the top 20 for me.

I want to make myself a faster programmer and able to code more on my feet under pressure. And having tried and true patterns on the top of your mind, will help.

What are some good websites to help keep me current with the latest and greatest for C#.NET Full Stack development?
What does it mean to be "Always On"?
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

I am starting a bit of a re-training session to get back into the work force after a few weeks out. The problem is my last job did a lot of legacy debugging on MVC and ASP.NET web pages, SQL Query db work SSRS updates.

Nothing too exciting and nothing too strength building for my next job.

I have done C#.NET Full Stack in various jobs before that but not made the jump to Angular, let alone Angular 2.

What are some good technologies today I should consider learning and what technologies are good to brush up on?

How about C#.Core? I do  not see too many EE mebers in that group...

What JS frameworks are the best to know?

I can devote lots of time to study, and would consider digging deep.

I had this question after viewing C# Bluezone Terminal Emulation, BZWHLL.WHLLOBJ.
<b>I'm trying</b>
                         int ist = EAdapter.Insert(txtclgname.Text,
                         txtErlno.Text, drpsem.SelectedItem.Text, drpEdu.SelectedItem.Text, drpBranch.SelectedItem.Text,
                         drpPassyear.SelectedItem.Text, float.Parse(txtCGPA.Text), drpreqskill.SelectedItem.Text, txtExSkill.Text, resume);

<b>how to fixed it</b>
Hi Experts,

My customer needs a report like this(Please see the attached report). How to create something like this. I have all the Data. I am using ASP.Net, VB.Net and RDLC reports. Please help.

Thanks in advance.
Paypal button is not shown :(
 <div class="text-center">
   <asp:Button ID="btn_Back" runat="server" OnClick="btn_Back_Click" Text="Back" />
 <div id="paypalpay" style="display: none;">Here!
                        <div class="form-group">
                            <div class="col-sm-offset-2 col-md-6">
                                <asp:ImageButton ID="btnCheckout" runat="server" ImageUrl="https://www.paypal.com/en_US/i/btn/btn_xpressCheckout.gif"
                                    Width="145" AlternateText="Check out with PayPal"
                                     BorderWidth="0" OnClick="btnCheckout_Click" />
        <!-- try another checkout way -->
       <!-- &nbsp;<asp:Button ID="Button1" runat="server" Text="Paypal Checkout"/> -->
       <br />

Open in new window

How do I correct this error at the top part of the codes
public partial class Checkout_CheckoutSuccess : System.Web.UI.Page
    string _connStr = ConfigurationManager.ConnectionStrings["EventContext"].ConnectionString;
    SqlConnection conn = new SqlConnection(_connStr);

    string order = "";
    string order_id;
    string s;
    string t;
    string[] a = new String[6];
    protected void Page_Load(object sender, EventArgs e)
        order = Request.QueryString["order"].ToString();
        if (order == Session["order_no"].ToString())
            //get user details and store in order_details table
            SqlCommand cmd = conn.CreateCommand();
            cmd.CommandType = CommandType.Text;
            cmd.CommandText = "select * from Users where email='" + Session["user"].ToString() + "'";
            DataTable dt = new DataTable();
            SqlDataAdapter da = new SqlDataAdapter(cmd);
            foreach (DataRow dr in dt.Rows)
                SqlCommand cmd1 = conn.CreateCommand();
                cmd1.CommandType = CommandType.Text;
                cmd1.CommandText = "insert into Orders values('" + dr["name"].ToString() + "','" + dr["email"].ToString() + "','" + dr["contact"].ToString() + "')";
            //end storing user details
            //get order is from order table


Open in new window

Hello everyone

Here i want the ruler control like photoshop in c# toolbox is this possible, or i can create own ruler if possible please guide me, im just fresher

thanks in advance
We have an older Windows server (Contract) and I need some vb.net code that looks at the C: drive and gets me a simple GB and %free remaining

10.25 GB and 25%free
protected void Button7_Click(object sender, EventArgs e)

        string result = null;


        string[] DIMVALUE = { "HISTORY X=500", "GEOGRAPHY K=900", "ENGLISH L1=100", "ENGLISH L2=1100", "ENGLISH H=100", "MATHS L=300" };

        if (OUTFORMULA != null)
            string re1 = null;
            for (int i = 0; i < OUTFORMULA.Length; i++)
                string re = null;
                for (int j = 0; j < DIMVALUE.Length; j++)
                    string[] str = DIMVALUE[j].Split('=').ToArray();
                    if (OUTFORMULA[i] == str[0])
                        re1 = str[1];


                re = re + re1 + ",";

                result = string.Concat(result, re); // OutPut Should come only 100,300



On Demand Webinar: Networking for the Cloud Era
On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.


I done some sample code which should search matching record and display in specified format.

i am unable to get exact format.

my output is : 100,300 (because only matching ENGLISH H and MATHS L)

see my sample code's
If i have  expression like 100*100-10+20 so I want *,-,+ in seperate variable what i need to do this
here i have some code ,
string expr = "5*10-18/(3+19)";

foreach(var match in Regex.Matches(expr, @"([*+/\-)(])|([0-9]+)"))
    `enter code here`Console.WriteLine(match.ToString());
I have panel that has multiple pictureboxes which are added dynamically at runtime.  The pictureboxes can be moved around the panel individually or as a user defined group.  I want the user to be able to drag a mouse across the screen to "define" which pictureboxes are selected.  

here is the code

 private void button1_Click(object sender, EventArgs e)
            OpenFileDialog d = new OpenFileDialog();

            // allow multiple selection
            d.Multiselect = true;

            // filter the desired file types
            d.Filter = "JPG |*.jpg|PNG|*.png|BMP|*.bmp";

            // show the dialog and check if the selection was made
            if (d.ShowDialog() == DialogResult.OK)
                int n = 4;
                foreach (string image in d.FileNames)
                    // create a new control
                    PictureBox pb = new PictureBox();

                    // assign the image
                    pb.Image = new Bitmap(image);

                    // stretch the image
                    pb.SizeMode = PictureBoxSizeMode.StretchImage;
                    // set the size of the picture box
                    pb.Height = pb.Image.Height / 10;
                    pb.Width = pb.Image.Width / 10;

                    // add the control to the container
and now my query is if i select any of …
Hi Experts!

Need your help updating LINQ query.

The LINQ query should return a distinct record of locationId and phonenumber.
Then which need to extract locationId and phonenumber and store it in local variables.

SQL Query:

FROM dbo.personProducts pp
     INNER JOIN dbo.personPhonesLocations phoneLocation ON pp.personLocationRecID = phoneLocation.personLocationRecID
     INNER JOIN dbo.personLocations personlocation ON pp.personLocationRecID = personlocation.personLocationRecID
     INNER JOIN dbo.Phones phone ON phoneLocation.PhoneID = phone.PhoneID
     INNER JOIN dbo.PhoneTypes PhoneTypes ON pl.PhoneTypeID = PhoneTypes.PhoneTypeID
WHERE pp.PersonNumber = 'ABC123'
      AND PhoneTypes.PhoneTypeName = 'Contact Number'

Open in new window

C# method:
var personPhone = (from pp in dataContext.personProducts
from phoneLocation in dataContext.personPhonesLocations
from personLocation in dataContext.personLocations
from phone in dataContext.Phones
from phoneType in dataContext.PhoneTypes
where pp.PersonNumber == "ABC123" && phoneType.PhoneTypeName == "Contact Number"
select new
LocationId = personLocation.LocationID,
phonenumber = phone.PhoneNumber

if (personPhone != null)
    string locationId = ???; <-- need help
    string phonenumber = ??  <-- need help


Open in new window

I inherited a C# application.  The development environment is Win10 64 bit, VS 2012 and the development machine has Microsoft Office Pro 2016 installed.  The problem is that the C# application has a lot of references to Microsoft.Office.Interop.Word which utilizes MS Office 2003 if I recall correctly (version 11 as opposed to version 14).

I can't get past this build error which states:

Assembly 'Microsoft.Office.Interop.Word, Version, culture = neutral, Public Key Token.......' which is a higher version than referenced assembly 'Office, Version=, Culture neutral....."

I cannot remove the reference to either assembly without breaking a significant amount of the existing code.  I originally tried installing both and setting the 'Embed Interops Types = False' at the recommendation of .Net but that did not resolve the issue.

Any suggestions?
We have a website and we want to record some instructions --> open the site, login, go thru the menus, etc. Like an instruction video.

Someone tried Webex, it didn't work (he said he gave up). Another tried Skype but couldn't get it working.

I found this that's free download  https://www.bandicam.com/  (they have a paid version too)

That works but anyone has used it? I don't know how to record my voice.

Any other tools I can use?






C# is an object-oriented programming language created in conjunction with Microsoft’s .NET framework. Compilation is usually done into the Microsoft Intermediate Language (MSIL), which is then JIT-compiled to native code (and cached) during execution in the Common Language Runtime (CLR).