System.Linq.Strings is inaccessible due to its protection level
Hello,
I'm trying to enhance a program that one of our ex employee's built but not having much luck. I'm totally new to C# but have built other small programs using vb 2008. What I'm trying to do is take a textbox that gets populated from a barcode label using a symbol scanner and split the information into two other textboxes I have done this successfully in VB but C# throws a System.Linq.Strings is inaccessible due to its protection level. I'v searched and cant seem to find the solution. The program works as designed but when I insert the following code I get the error. Anyone wanna take a crack at it thanks. STRINGS is were the error is occurring
private void OrderNumber_TextChanged(object sender, EventArgs e)
{
Array split = ScannedBC.Text.Split('-');
if (split.Length == 2)
{
OrderNumber.Text = Strings.Split(0);
ShipNumber.Text = Strings.Split(1);
ShipNumber.Text = ShipNumber.Text.Substring(3, ShipNumber.Text.Length - 3);
OrderNumber.Text = OrderNumber.Text.Substring(1, OrderNumber.Text.Length - 1);
}
}
}
}
here are the references
using Microsoft.VisualBasic;
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Data.SqlClient;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
Sam HobbsPosted Dec 2, 2010, 7:51 PM
Sam HobbsPosted Dec 2, 2010, 9:37 PM
Note that you need to adjust that code slightly because I modified your code so I could test it. My version was tested and works.
Mike MaysPosted Dec 2, 2010, 9:00 PM
Array split = ScannedBC.Text.Split('-'.ToString().ToCharArray());
if (split.Length == 2)
{
OrderNumber.Text = (string)(split.GetValue(0));
ShipNumber.Text = (string)(split.GetValue(1));
ShipNumber.Text = ShipNumber.Text.Substring(3, ShipNumber.Text.Length - 3);
OrderNumber.Text = OrderNumber.Text.Substring(1, OrderNumber.Text.Length - 1);
spik_jkPosted Dec 2, 2010, 3:37 PM
You assign a the Ordernumber.Text a string array, but it only takes a string as a value! I will only give a hint for you to continue on!
Since, IF you are not intersted then im not by giving you some code