Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
A

Acuena

@Acuena
About
Posts
15
Topics
6
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Make textbox fill up and resizie
    A Acuena

    Hi! Sorry for weird subject but was a bit unsure on what to call it. Anyway, I have a WPF-form where I have some items below a textbox. I want the textbox to fill up the grid above the bottom controls but leave space for them.

    WPF csharp css wpf

  • {Solved} Find and count duplicates in a list
    A Acuena

    Thanks for the help! That worked like a charm. Was unfamiliar that you could hover the mouse over the variable and the IDE would tell you what type it was. On the PC I am on now, at work, I can't install a newer framework, so I had to redo the code to not use String interpolation, sadly. Also I am using SharpDevlop. Anyhow, thanks for the help :)

    Have a nice day!

    C# regex question visual-studio help tutorial

  • {Solved} Find and count duplicates in a list
    A Acuena

    I have never used LinQ, and as such I am a bit unsure what GroupBy returns and what type x is. And about the ToString, I was just testing, all (or many) does... Here is the whole code I have, if anyone is interested:

    using System;
    using System.Collections.Generic;
    using System.Windows;
    using System.IO;
    using System.Linq;

    namespace Inventory
    {
    /// /// Interaction logic for Window1.xaml
    ///
    public partial class Window1 : Window
    {
    void button1_Click(object sender, RoutedEventArgs e)
    {

    		string\[\] lines = File.ReadAllLines(@"C:\\Users\\sdadmin\\Desktop\\Test data.txt");
    		var barcodes = lines.Select(line => {string\[\] parts = line.Split(',');
    		                            	return parts\[2\]; });
    		var x = barcodes.GroupBy(b => b);		
    	}
    	
    	public class List
    	{
    		public string Date{get; set;}
    		public string Time{get; set;}
    		public string EAN {get; set;}
    	}
    }
    

    }

    I am pretty new to C#, I have only been at it for about 1 month or so, if I disregard time when I don't do any programming...

    Have a nice day!

    C# regex question visual-studio help tutorial

  • {Solved} Find and count duplicates in a list
    A Acuena

    Hi! Sorry for late reply, been a bit busy. Anyhow, I have tried your example, but how can I output it to a Listview? I have the following code now:

    string[] lines = File.ReadAllLines(@"C:\Users\\Desktop\Test data.txt");
    var barcodes = lines.Select(line => {string[] parts = line.Split(',');
    return parts[2]; });
    var x = barcodes.GroupBy(b => b);

    Tried differnt mthoods, among other: Messagebox.Show(x.ToString()); That failed :P Thankfull for any help.

    Have a nice day! I have a new IDE!

    C# regex question visual-studio help tutorial

  • {Solved} Find and count duplicates in a list
    A Acuena

    Hi all! Got a new question. I have a barcode scanner that saves all scanned barcodes in the following format: Date,Time,Barcode Example:

    2020-07-08,13:54:16,1578456329781
    2020-07-08,14:07:13,1578453697235
    2020-07-08,14:08:03,1548795358155
    2020-07-08,14:11:09,1578453697235
    2020-07-08,14:11:42,1578453697235

    Now I add this to a ListView in Gridview mode with the following code:

    List items = new List();
    string[] lines = File.ReadAllLines(@"F:\BARCODE.txt");

    foreach (string line in lines)
    {
    string Pattern = @"(?\d{4}-\d{2}-\d{2})(?:,)(?\d{2}:\d{2}:\d{2})(?:,)(?\d*)";
    Regex R = new Regex(Pattern);
    Match m = R.Match(line);
    items.Add(new List() { Date = m.Groups["Date"].ToString(),
    Time = m.Groups["Time"].ToString(), EAN = m.Groups["EAN"].ToString() });
    }
    LvItems.ItemsSource = items;

    Now I want to be able to count if there are any duplicates, and show the results in a new ListView like this: (| shows new Column in the gridview)

    1578456329781|1
    1578453697235|3
    1548795358155|1

    Does anyone have a better idea than using a atleast two loops to do this? I was thinking on using one loop to go threw the list, and then use the second loop to check for duplicates and count. Wondering if there are a simplier solution for this. Any help, as always, are much appreciated.

    Have a nice day! Have gotten a new IDE :)

    C# regex question visual-studio help tutorial

  • WPF C# Make window's the same width as the screen
    A Acuena

    I was about to try Gerry's suggestion when I decided to test retriving the screen width with code and set the window size to it. It worked, but I wonder, is there not a way to do this without using code in WPF? Here is the code I used if someone is interested:

    this.Width = System.Windows.SystemParameters.PrimaryScreenWidth+2;

    Note that +2 is there since the Windows Left parameter in the XML are set to -2, had to compensate for that or I get a small gap to the right. I put it right below the "InitializeComponent();" call.

    Have a nice day! Thinking of getting a new IDE!

    WPF csharp wpf wcf tutorial question

  • WPF C# Make window's the same width as the screen
    A Acuena

    Hi! SO close :) It gives a very small gap between the screen edge and the window. I took a screenshot of the screen so that I could zoom in and check how many pixels there was between the window and the screen. It's around 8 pixels gap on the right side. And even if I set Left and Top to 0, I get one pixel from the top and 8 from the Left. Here is the XML code for the window that I have now:

    I would want it go to to the edge and there to be no gaps. Thanks for the help so far :)

    Have a nice day! Thinking of getting a new IDE!

    WPF csharp wpf wcf tutorial question

  • WPF C# Make window's the same width as the screen
    A Acuena

    Hi! I am trying to make a window that when it starts, takes up the entire width of the screen, regardless of resolution. I have tried to set the Width to 100% and to bind it to the primary screen width

    Width="{Binding SystemParameters.PrimaryScreenWidth}">

    But neither worked :(. Anyone have any idea on how to do it?

    Have a nice day

    WPF csharp wpf wcf tutorial question

  • WPF Make window take the whole with of the screen
    A Acuena

    Ok, could you delete it and then I can re-post it in the WPF forum instead?

    C# csharp wpf question wcf algorithms

  • WPF Make window take the whole with of the screen
    A Acuena

    Wonder why I did not see that section before... Is there an option to either move this threed or delete it so it can be in the correct forum?

    Have a good day all :)

    C# csharp wpf question wcf algorithms

  • WPF Make window take the whole with of the screen
    A Acuena

    Hi! Sorry if I post this question in the wrong section, unsure if it should be in C# or XML. Anyway, what I want to do is make a window in WPF resize to the width of the screen. I have tried searching on Google but havent found a way to do it. One page said to use a Binding in the width property but that did not work. I have also tried to set it to 100% but that did not work either. Anyone have any idea on how to do it?

    C# csharp wpf question wcf algorithms

  • [Solved] Safe way to insert USB-drive.
    A Acuena

    Ow ya, did not think about the USB-killers and the modified firmware thing. That makes it much more harder to protect against bad USB with a software, it would make it impossible for the USB killer part. Guess you could protect against the USB-Killer attack by having a external device you can use as a sacrifice thing between the PC and the USB, it must be able to handle the surge though. Guess we have to stick to not allow it then unfortunately.

    C# question windows-admin tools

  • [Solved] Safe way to insert USB-drive.
    A Acuena

    Yes, this is another problem I did not think off. Thanks for that :)

    C# question windows-admin tools

  • [Solved] Safe way to insert USB-drive.
    A Acuena

    Hi! Long time lurker here with a question. I am thinkig of making a software that temporarily disables windows from auto-running a application when inserting a cd or usb. To do this, I need to edit a key in the registry, that is no hard to do. What I want to know if this is enughe to stop malware from getting on my pc if I insert a usb-drive or cd, or if I am still risking getting a virus/malware on my pc. If I understand it enughe, for a virus or other malicius software to infect my pc, dosen't it have to run some kind of script or app for it? Would doing the above prevent that from happening or is it still dangerus to insert unknown usb drives into my pc, even with the auto run feature turned off?

    Have a nice day Acuena

    C# question windows-admin tools

  • Applications settings get messed up
    A Acuena

    Hi all! New to the forum ;) I have a made a application that stores it's settings with the following code:

    Properties.Settings.Default.Username= TxtUsername.Text;
    Properties.Settings.Default.Password = TxtPassword.Text;
    Properties.Settings.Default.Tel = TxtTel.Text;
    Properties.Settings.Default.EMail = TxtEMail.Text;
    Properties.Settings.Default.Save();

    Loading the settings works just fine, but with one exception. If I change the code in any way, the settings changes to "\r\n\t\t\t\t". I can image it is because the application has changed or something like that. But is there any way to make it so it changes to "" instead? Want to make a function to check if the settings have been set by checking each of them if they are null. Dosent work that well if they either are null or contain "\r\n\t\t\t\t". Note that I am using SharpDevelop, I am at work and I can't get VS Studio here, unfortunatly.

    C# visual-studio question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups