winforms,visual-studio-2013,c++-cli , How to create a folder that contains the current date and time instead of name


How to create a folder that contains the current date and time instead of name

Question:

Tag: winforms,visual-studio-2013,c++-cli

I use C++ Windows Form application in Visual Studio 2013 for one project. I wonder how to create a folder that contains the current date and time instead of name? It is possible to make such folder??

DirectoryInfo^ directory = Directory::CreateDirectory("C:\Users\Desktop\" + ??);

Answer:

Don't hard-code the desktop directory name, it is not c:\users\desktop. .NET makes it easy:

String^ path = System::IO::Path::Combine(
    Environment::GetFolderPath(System::Environment::SpecialFolder::Desktop),
    DateTime::Now.ToString("yyyyMMddhhmmss"));
System::IO::Directory::CreateDirectory(path);
// Write file(s) to <path>
//...

It is up to you to decide how fine-grained to make the directory name, if you do this at a very high rate then you must append "fff" to reduce the risk for name collisions. If it is a once-a-week task then just the date part is enough.


Related:


Custom drawing using System.Windows.Forms.BorderStyle?


c#,.net,vb.net,winforms,custom-controls
I want to mimick drawing of default border based on value of property BorderStyle. Instead of single border around the control, my control is visualised as four adjacent custom-drawn boxes (2×2), each having standard border drawn individually. So for example, if Control.Border is set to FixedSingle value I want to...

Visual Studio 2013 LINK : fatal error LNK1181: cannot open input file


c++,visual-studio,opencv,visual-c++,visual-studio-2013
I am using Visual Studio 2013. I'm trying to build some code given to me from my professor and I keep getting this error: LINK : fatal error LNK1181: cannot open input file 'C:\Users\manduchi\Documents\eyegaze\EyeGazeDemo..\Libraries\OpenCV\lib\opencv_core249.lib' However, on my computer opencv_core249.lib is located somewhere else. I've tried updating the linker directories to...

Form controls not showing


c#,forms,winforms,user-interface,user-controls
I'm making a console application that shows a form. I created the form from scratch. When I run the program, the form shows, but the controls I added don't show. My code: using System; using System.Windows.Forms; using System.Drawing; namespace form { public class main { public static void Main() {...

Move windows form from a picturebox in C#


c#,.net,winforms,picturebox
I have a windows form without any border. So i added a picture box and i want the whole form to be moved when that picture box is clicked. public const int WM_NCLBUTTONDOWN = 0xA1; public const int HT_CAPTION = 0x2; [DllImportAttribute("user32.dll")] public static extern int SendMessage(IntPtr hWnd, int Msg,...

Value cannot be null when deserializing JSON


c#,winforms,json.net
I have a db table which has column in which content is stored in JSON format, I am retrieving JSON but I am getting this error. Value cannot be null Here is my code snippet. var stuff = (JObject)JsonConvert.DeserializeObject(commentId); string name = stuff["Name"].Value<string>(); string email = stuff["Email"].Value<string>(); string company =...

How can i get list of my youtube videos from youtube?


c#,.net,winforms,youtube,youtube-api
I installed the google api 3 and the OAuth2. And i tried the google develope example: using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using Google.GData.Client; using Google.GData.Extensions; using Google.GData.YouTube; using Google.GData.Extensions.MediaRss; using Google.YouTube; namespace Youtube_Manager { public partial class...

Custom Numericupdown


c#,winforms,custom-controls
I'm trying to create a custom numericUpDown control. I'm trying to add text to the numericUpDown and I got it working good. But, now I want to find a way to select only the number when clicking in the control, because at this moment when I "edit" the value manually,...

OData Endpoint with .NET


c#,asp.net,visual-studio-2013,odata,web-api
I am trying to create an odata endpoint for a table valued function in a database. I am sure with the code, however upon running the application i get the error Server Error in '/' Application. Parser Error Description: An error occurred during the parsing of a resource required to...

Set Label From Thread


vb.net,multithreading,winforms
Form1.vb Imports System.Threading Public Class Form1 Dim demoThread As Thread Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Dim Start As New Class1 Me.demoThread = New Thread( _ New ThreadStart(AddressOf Start.ThreadProcSafe)) Me.demoThread.Start() End Sub Delegate Sub SetTextCallback([text] As String) Public Sub SetText(ByVal [text] As String) ' InvokeRequired required...

Searching user tasks by task.body text


c#,visual-studio-2013,vsto,outlook-addin
Good morning all! I have spent a good bit of time searching and reading forums about this, but I can't seem to find a solution. Any help you all can offer is greatly appreciated. I have created an Outlook Add-In via C# and Visual Studio 2013. This add-in will create...

How to change background Color of label full length when Mouse Hover in c#


c#,winforms
I can't Select label back Ground color Mouse Hover event in full length,only can select The Word length I would like to get log out background same like username background as full width private void label5_MouseHover(object sender, EventArgs e) { this.LblChange.BackgroundImage = null; this.LblChange.BackgroundImage = global::Flex.Properties.Resources.Mail1; this.LblChange.BackColor = Color.Blue; this.LblChange.BackgroundImageLayout...

Why does this code to replace accented chars with html codes fail to work?


c#,html,winforms,diacritics,accented-strings
I want to replace accented chars (such as á, ñ, ¿, ¡, etc.) with the corresponding HTML codes (such as á, ñ, ¿, ¡, etc.). For example, this line of text: Imposible me ha sido rehusarme á las repetidas instancias que el Caballero Trelawney, el Doctor Livesey y otros muchos...

Visual Studio 2013 Report RDLC with related datasets


visual-studio-2013,report,relational-database,rdlc
I currently have two tables in a database "customer" and "pricelist" where a customer can have multiple pricelist items linked to their ID. I'm trying to build a report in VS2013 where it lists all customers [alphabetically], then all of their pricelist items [alphabetically], then page break between each customer....

How do I install the Wix extension on after a Visual Studio 2013 Update?


visual-studio-2013,wix
I have installed Wix 3.9 on VS 2012. Recently, I just got VS 2013 and I am not sure how to install just the extension on there? How do I do without uninstalling wix 3.9 and reinstalling it back again?...

C# Windows Form Application - value not printing in textbox for each time


c#,winforms,textbox,windows-forms-designer,form-control
Value not printing in textbox for each time.. Iam able to see last value only (10) in textbox. private void button1_Click(object sender, EventArgs e) { for(int i = 0; i<=10; i++) { textBox1.Text = i.ToString(); Thread.Sleep(100); } } ...

How to make inherited form full screen [on hold]


c#,winforms
I am having some trouble trying to get a windows form project go full screen and to hide the taskbar. I am inheriting forms from a master form. When I add the following code it still shows the task bar at the bottom. this.TopMost = true; this.FormBorderStyle = FormBorderStyle.None; this.WindowState...

How to use XDocument to get attributes and add them to a List


c#,xml,winforms,list
I am trying to load data from an XML file and add it to a List. The XML file looks like this: and this is my code: public void LoadPayments(List<List<string>> list1, List<List<string>> list2) { try { if (File.Exists(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "RentData.xml"))) { int count = 0; XDocument doc; using (var reader =...

How to make if statement that checks if multple listBoxes are empty or not?


c#,winforms,if-statement,listbox
How do I make an if statement that asks if multiple listBoxes are empty or not? This is what I have so far...is it possible to combine it into one single if statement? if (listBoxEmails.Items.Count < 1) { //Perform action } if (listBoxWebsites.Items.Count < 1) { //Perform action } if...

Is it possible to login from a winforms application to a website which uses spring security?


java,c#,winforms,spring-mvc,spring-security
I want to call a web service from my winforms application. My application is written on c# and the webservice is secured using spring security. Is it possible to login to the website and call that web service?. If it is possible how to do that?...

DialogBox with value verifications


c#,.net,winforms
For my application which deals with graphics, I've made a little DialogBox to set: Max; Min; Major Step (of the scale); Minor Step. Here's a screen capture: I want to validate a few things before allowing the user to click Ok: Max >= Min MaxScale >= MinScale. But it's not...

VS2013 Error: LNK2019 When trying to build ZeroMQ server


c++,visual-studio-2013,zeromq
I'm trying to build this simple ZeroMQ server in C++ on Visual Studio 2013. #include "stdafx.h" #include "zmq.hpp" #include <string> #include <iostream> #include <windows.h> using namespace std; int _tmain(int argc, _TCHAR* argv[]) { // Prepare context and socket zmq::context_t ctx(1); zmq::socket_t sckt(ctx, ZMQ_REP); sckt.bind("tcp://*:5555"); while (true) { zmq::message_t request; //...

How to get previous version using git and VS Express for web 2013?


git,visual-studio-2013
I want to find the cause of a bug which caused by one of the recent commits. Is it possible to get a specific version, and then undo the checkouts?

Visual Studio Ctrl + F search freezes when including a '(' character


visual-studio,visual-studio-2013
For some reason whenever I include the '(' character in a Ctrl + F search in Visual Studio 2013 the search bar never works. It doesn't matter what other text is included in the search bar. It doesn't matter if I choose to search on just the current document, or...

MVP in WinForms ( presenter & program.cs)


c#,winforms,mvp
I'm learning an MVP pattern and have the following issues: If I have one form(project MainForm), one model(project Model) and one presenter, should I create a new project for my presenter or it's ok to put it in MainForm project? 1)If presenter must be located in separate project, it obviously...

Application is missing required files


c#,.net,windows,winforms,sharpdevelop
Pic of Error: http://s23.postimg.org/7uj6qcxtn/9708083373e57a9ec91e4296e302f88e.png Cannot Download the Application. The Application is missing required Files. Contact Application Vendor For Assistance. So I'm building a windows form application using SharpDevelop 5.2 and I'm trying to make a standalone/version someone else would be able to use on another machine. In sharpdevelop (and visual...

How to create a folder that contains the current date and time instead of name


winforms,visual-studio-2013,c++-cli
I use C++ Windows Form application in Visual Studio 2013 for one project. I wonder how to create a folder that contains the current date and time instead of name? It is possible to make such folder?? DirectoryInfo^ directory = Directory::CreateDirectory("C:\Users\Desktop\" + ??); ...

getting keyboard input in winform listbox


c#,winforms,keyevent
i am altering a program so that a listbox picks up keyboard input (number pad, D0-D9, letter keys) and edits properties of the currently selected listbox item based on the input. my problem is that there seems to be no functionality that can convert a key press into a letter....

Improve DataGridView rows managing


.net,vb.net,winforms,datagridview,datatable
SCENARIO I'm manually filling a DataGridView with a DataGridViewRow collection: I created the columns at design time in the GUI builder of Visual Studio. First column takes an Integer value, its a DataGridViewTextBoxColumn. Second column takes an Icon object, its a DataGridViewImageColumn. Third column takes a String value, its...

Visual Studios building and debugging .cpp file without main()


c++,assembly,visual-studio-2013
Professor just gave us a block of c++ code in order to learn about the debug windows in Visual Studio, however after creating a blank win32 console project and then dragging in the .cpp file I get the missing .exe error message when attempting to debug. I've looked everywhere and...

Why when adding items to combobox it's adding the same item many times?


c#,.net,winforms
In the top of form1: public class ComboboxItem { public string Text { get; set; } public object Value { get; set; } public override string ToString() { return Text; } } List<string> results = new List<string>(); Then: ComboboxItem item = new ComboboxItem(); var result = videoCatagories.Execute(); for (int i...

IIS Express 8 - Max allowed length


c#,asp.net,iis,visual-studio-2013,iis-express
In case the below is too long, my question is whether IIS Express 8 in Visual Studio 2013 obeys the maxAllowedContentLength attribute or if it has some overriding value that prevents large requests When debugging some webapi calls against Visual Studio 2013, I'm receiving this error: Maximum request length exceeded....

HTTP Error 403.14


asp.net-mvc,visual-studio-2013
I'm developing my MVC 5 app using VS 2013, it was working fine, but suddenly it's giving the following error. HTTP Error 403.14 - Forbidden The Web server is configured to not list the contents of this directory. I've already read this post, and it didn't solve the problem. I've...

Getting Multi Rows in Database and transferring it in a multiline textbox in VB.net WinForms


database,vb.net,winforms,textbox
Here in my code, i have a database which has table of my applicants. As you will see in the code below, i want to get the number of rows from my command text and transfer it to the string "abc" Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As...

How to use ajax to post json string to controller method?


jquery,asp.net-mvc,visual-studio-2013,asp.net-mvc-5
I want to be able to post a json string to a control action but it's always receive the string as null. If I create a view model for the controller method, it works, but that's not what I want since there will be too much view models to maintain....

Updating a list of objects bound to a DataGridView from a popup form


c#,winforms,datagridview
I seem to be having a bit of a problem with returning the updated information on my edit button placed on the popup form, back to my DataGridView (which is bound to a list of objects) on the original form. I seemed to have it working the other day, however,...

How can I add a .props file to a C# project?


azure,visual-studio-2013,azure-webjobs
I am trying to set up continuous delivery of Azure Web Jobs, and came across this post from the Azure blog. One of the steps there is to add a .props file to the web job application's properties. I am having difficulty adding a .props file. My web searches indicate...

How can i put formclosing event in Button


c#,winforms
i make this button btnCallenge and i want if the person click on it the form can't be closed if he try to close it i want the form cant be closed if the user click on chellange button public void btnChallenge_Click(object sender, EventArgs e) { } private void Form1_FormClosing(object...

Visual Studio Assembly force-installs Target Framework


c#,.net,visual-studio-2013,.net-framework-version
I have this Assembly targeted at .NET 3.5. The code will work on later versions as well, but I like this to work on Windows XP. I mean, .NET is backwards compatible, right? I can run apps for .NET 3.5 on Windows 8.1. However, when I run my own assembly,...

How do I keep previously painted objects from disappearing when a new one is creating in a Windows Form Application?


c#,winforms
My problem is that within my Windows Form Application, I want to draw an Ellipse everytime the mouse is clicked within a specific picture box, and I want the previously drawn ellipses to remain present in the picture box. In its current state, once the mouse is clicked, the previously...

Notify winforms application by Sql Server database changes


c#,.net,sql-server,winforms,sqldependency
I created a Sql server database, in which I added a table named user. Then I executed this script ALTER DATABASE [TestNotification] SET ENABLE_BROKER I'd like to use SqlDependency class to notify a winforms application when the user table were changed. namespace Watcher { public partial class Form1 : Form...

DataGridView KeyDown manipulation (enter, left, right, etc.) not working when multiselect


c#,winforms,datagridview,multi-select
I want to make the DataGridView more handy while manipulating the KeyDown event, like the KeyEnter for moving one cell to the right, or using left, down or up. I have some special use cases where I want to check first the cell and depending on that I can discard...

Dynamically Resizing Controls on Windows Forms


c#,winforms,layout
I has a winform which can be resize. I has 4 chart control in the form and sit side by side. When the form is in maximum size, the layout of each chart control is run out. I try to set the anchor style but i got no luck. How...

How do I display an Icon on the Taskbar but not on the form itself?


vb.net,winforms,visual-studio
If I use ShowIcon in the form properties, I get the icon in the top left of my form (I don't want that), but I do get my icon in the taskbar. If I turn ShowIcon off, then I get no icon on the form but I get the default...

The name 'Thread' does not exist in the current context


c#,visual-studio-2013,namespaces
When I put this code Thread.Sleep(2000); it gives me the error: The name 'Thread' does not exist in the current context`. I already included the namespace using System.Threading;. See System.Threading.Thread.Sleep() on MSDN....

devenv.exe hogs CPU when debugging


asp.net-mvc,visual-studio-2013
Short version: When I debug ASP.NET MVC apps in VS2013 and try to edit razor views or css files, the CPU usage of devenv.exe skyrockets to the point where VS becomes unresponsive. Browser link is turned off, yet this still happens. Restarting debugging doesn't help, restarting VS doesn't help, restarting...

Using Try/Catch block to set file path?


visual-studio,visual-studio-2013
I'm having a bit of trouble figuring out an assignment for my Visual Basic course. I am told to assume that a given text file is not in the \bin\Debug folder of my program, so I am trying to throw an exception error and get the correct path from the...

Copying CMD output to clipboard


c#,winforms,cmd
I'm trying to copy output from a program running out of the CMD prompt to the Windows clipboard. private void button1_Click(object sender, EventArgs e) { /*Relevant Code*/ Process p = new Process(); p.StartInfo.UseShellExecute = false; p.StartInfo.RedirectStandardOutput = true; p.StartInfo.FileName = "cmd.exe"; p.StartInfo.Arguments = String.Format("/k cd {0} && backdoor -rt -on...

Load all user controls of a form on start


c#,winforms,events,user-controls
My Winform application has a main form with a tab control. In each tab there is a User Control. And each user control has Controls (such as DataGridViews, etc) that are loaded on the Load event of the user control. The problem I have is that I would like to...

Managing per form ObjectContext lifetime


c#,winforms,entity-framework,orm
For ORMs like EF and NHibernate, multiple places suggest using "context per method" (or per request, per transaction) for web apps and services and using "context per form" for thick clients like WinForms and WPF. In C#, resource disposal with context per method is clean and clear with a using...