Click here to Skip to main content
16,016,760 members
Home / Discussions / C#
   

C#

 
AnswerRe: float to and from frequency Pin
Mycroft Holmes17-Apr-15 22:51
professionalMycroft Holmes17-Apr-15 22:51 
GeneralRe: float to and from frequency Pin
DaveyM6918-Apr-15 0:03
professionalDaveyM6918-Apr-15 0:03 
QuestionRe: float to and from frequency Pin
Kenneth Haugland17-Apr-15 23:23
mvaKenneth Haugland17-Apr-15 23:23 
AnswerRe: float to and from frequency Pin
DaveyM6918-Apr-15 0:00
professionalDaveyM6918-Apr-15 0:00 
GeneralRe: float to and from frequency Pin
Kenneth Haugland18-Apr-15 0:40
mvaKenneth Haugland18-Apr-15 0:40 
GeneralRe: float to and from frequency Pin
Kenneth Haugland18-Apr-15 0:43
mvaKenneth Haugland18-Apr-15 0:43 
GeneralRe: float to and from frequency Pin
DaveyM6918-Apr-15 3:02
professionalDaveyM6918-Apr-15 3:02 
QuestionDataTable output to string with filter Pin
Blubbo17-Apr-15 8:58
Blubbo17-Apr-15 8:58 
What I am trying to accomplish is that I am making the datatable to interpret large data. I only wanted to print out the header, then the data. Also only to show "Variable" and "Value" columns.
I'm not sure how to weed out the "Hex Value" column. Also to list the rows that are (Hidden = false).
I'm not sure how to accomplish this.

On the bottom code (with variable "res" does show all of the rows with all of the columns, but no header... Sigh | :sigh:
C#
DataTable dataTable = new DataTable();
dataTable.Columns.Add("Variable", typeof(string));
dataTable.Columns.Add("Hex Value", typeof(Int64));
dataTable.Columns.Add("Value", typeof(string));
dataTable.Columns.Add("Hidden", typeof(bool));

dataTable.Rows.Add("Ronald", 0x0, "Value = 0", false);
dataTable.Rows.Add("Ronald", 0x1, "Value = 1", false);
dataTable.Rows.Add("Ronald", 0x2, "Value = 2", true);
dataTable.Rows.Add("Ronald", 0x4, "Value = 4", true);
dataTable.Rows.Add("Ronald", 0x8, "Value = 8", false);
dataTable.Rows.Add("Ronald", 0x16, "Value = 16", true);
dataTable.Rows.Add("Ronald", 0x32, "Value = 32", false);
dataTable.Rows.Add("Ronald", 0x64, "Value = 64", false);
dataTable.Rows.Add("Ronald", 0x128, "Value = 128", false);
dataTable.Rows.Add("Ronald", 0xFF, "Value = 255", true);

try
{
   DataRow selectedRow = dataTable.Select("").FirstOrDefault(x => (Int64)x["Hex Value"] == Convert.ToInt64(tb_Input.Text, 16));
   lbl_Result.Text = selectedRow["Value"].ToString();
}
catch
{
   lbl_Result.Text = "Unknown";
}

string res = String.Join(Environment.NewLine, dataTable.Rows.OfType<DataRow>().Select(x => String.Join(" ; ", x.ItemArray)));

MessageBox.Show(res);

GeneralRe: DataTable output to string with filter Pin
PIEBALDconsult17-Apr-15 9:06
mvePIEBALDconsult17-Apr-15 9:06 
GeneralRe: DataTable output to string with filter Pin
Blubbo17-Apr-15 9:35
Blubbo17-Apr-15 9:35 
GeneralRe: DataTable output to string with filter Pin
Blubbo17-Apr-15 9:49
Blubbo17-Apr-15 9:49 
GeneralRe: DataTable output to string with filter Pin
Sascha Lefèvre17-Apr-15 9:53
professionalSascha Lefèvre17-Apr-15 9:53 
GeneralRe: DataTable output to string with filter Pin
Blubbo17-Apr-15 9:56
Blubbo17-Apr-15 9:56 
GeneralRe: DataTable output to string with filter Pin
Sascha Lefèvre17-Apr-15 11:52
professionalSascha Lefèvre17-Apr-15 11:52 
AnswerRe: DataTable output to string with filter Pin
Sascha Lefèvre17-Apr-15 10:26
professionalSascha Lefèvre17-Apr-15 10:26 
GeneralRe: DataTable output to string with filter Pin
Blubbo20-Apr-15 1:52
Blubbo20-Apr-15 1:52 
GeneralRe: DataTable output to string with filter Pin
Sascha Lefèvre20-Apr-15 1:57
professionalSascha Lefèvre20-Apr-15 1:57 
QuestionTime delay without freezing the GUI Pin
Member 1085025317-Apr-15 5:24
Member 1085025317-Apr-15 5:24 
AnswerRe: Time delay without freezing the GUI Pin
OriginalGriff17-Apr-15 5:46
mveOriginalGriff17-Apr-15 5:46 
GeneralRe: Time delay without freezing the GUI Pin
PIEBALDconsult17-Apr-15 6:46
mvePIEBALDconsult17-Apr-15 6:46 
GeneralRe: Time delay without freezing the GUI Pin
Member 1085025317-Apr-15 7:03
Member 1085025317-Apr-15 7:03 
GeneralRe: Time delay without freezing the GUI Pin
Sascha Lefèvre17-Apr-15 7:37
professionalSascha Lefèvre17-Apr-15 7:37 
GeneralRe: Time delay without freezing the GUI Pin
Eddy Vluggen17-Apr-15 8:23
professionalEddy Vluggen17-Apr-15 8:23 
AnswerRe: Time delay without freezing the GUI Pin
Richard MacCutchan17-Apr-15 5:46
mveRichard MacCutchan17-Apr-15 5:46 
QuestionLock client application (controlled) on call for Form Pin
Member 998884817-Apr-15 4:03
Member 998884817-Apr-15 4:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.