
Kurt
Avatar/Signature-
Posts
101 -
Joined
-
Last visited
Content Type
Profiles
Forums
Blogs
Events
Articles
Resources
Downloads
Gallery
Everything posted by Kurt
-
User control looses location in designer after rebuild
Kurt replied to Kurt's topic in Windows Forms
I would like to close my own thread since restarting Visual Studio fixed the problem... -
Hi, I made two user controls (just containing some labels and textboxes each). After building the project I added both of them on a windows form. When rebuilding the project, the designer shows one of the user controls in the top left corner of the windows form, but in the 'Windows Form Designer generated code' section, the control still has the correct Location property set! At runtime the controls are placed correctly, but the designer in Visual Studio displays the control at a wrong location at design time.
-
Thanx Derek, How to configure the ACLs? Should I make from the ASP.NET account on the server running the project a Domain account, and add that one to the server where the files should be written? Should I then right click the folder for the text files, choose properties and from the security tab add the user there? I guess I 'm a little confused. Kurt
-
I set up the following test in a mini - windows app. The idea is that the code could be used in an ASP.NET project later on. The general problem here is authentication... I have all the user rights to write to the mentioned server, but I don't know how to pass my credentials allong with the write command... The following is working: (writing to a new or overwriting an existing file locally) private void button1_Click(object sender, System.EventArgs e) { StreamWriter sw = null; try { sw = File.CreateText(@"C:\new text files\test.txt"); sw.Write("testing the method again again"); } catch (Exception exc) { MessageBox.Show(exc.ToString()); } finally { if (sw != null) { sw.Flush(); sw.Close(); } } } not working: (Writing the file to a network share) private void button1_Click(object sender, System.EventArgs e) { StreamWriter sw = null; try { sw = File.CreateText(@"\\10.0.0.20\files$\test.txt"); sw.Write("testing the method again again"); } catch (Exception exc) { MessageBox.Show(exc.ToString()); } finally { if (sw != null) { sw.Flush(); sw.Close(); } } } error: System.UnauthorizedAccessException: Access to the path "\\10.0.0.20\files$\test.txt" is denied. Also, mapping the "\\10.0.0.20\files$" folder to a new drive name (for example "Z:\") and using syntax as File.CreateText(@"Z:\test.txt"); is not working. Is there a way to attach some user credentials to the command, so it becomes authorized to write the file?
-
launch my app on double click of certain file extensions
Kurt replied to Kurt's topic in Windows Forms
but it doesn't work -
launch my app on double click of certain file extensions
Kurt replied to Kurt's topic in Windows Forms
ok, this looks promising System.Diagnostics.Process p = System.Diagnostics.Process.GetCurrentProcess(); switch (p.StartInfo.Verb){...} -
launch my app on double click of certain file extensions
Kurt replied to Kurt's topic in Windows Forms
Yes, when I add a file type in the File Types Editor, I have to specify the .exe that will run (command property). For that file type, I then have to specify an action that allows a parameter. The default value of that parameter is '%1', which seems to be the path of the file dubble clicked - exactly what I want! I managed to check in the Main routine of the .exe if there's a filepath and if so, I call a specilased constructor of my main form, taking the filepath as a parameter. I did this by defining my Main methode as taking an array of strings. That way I can just check if args (=the array of strings) has a Length of 0 or not. If not, args[0] contains the path of the file. And it works.... The commandline property would also work, but it would involve some regular expressions to extract the relevant data. But what I still don't understand is the Verb property of the attached action. The microsoft documentation says: But I can't see how this would work, I mean how to pick up from my code the name of the verb associated with the action? Let's say I just want an action called 'verify' that when clicked shows a messagebox saying wether or not the file contains valid data. I searched the web for this problem quite a bit, but I can't seem to find how to use the Verb property in the Deploy project from my source code. -
How to pick up the path of the file that was double clicked in windows and how to run the code that opens and displays the file?
-
launch my app on double click of certain file extensions
Kurt replied to Kurt's topic in Windows Forms
I set the association from the file type editor now, using Visual Studio. How to make a certain piece of code run to process the dubble clicked file now? -
I seem to remember that when you draw to a picturebox, the graphics are retained and automatically redrawn when for example another form covered your form and is then minimized...
-
I'm of course still interested in knowing how to control the version number myself in an automated way (without 3rd party controls)...
-
ok Ok, guess I just surfed enough to find an answer. Just tested that one, and it works fine. UTC is used, as stated in previous referenced microsoft article and not the local time as stated in this quote (also from microsoft, but if you're running a site that size, I guess inconsistencies are a thing one just has got to deal with). Next Line could replace the respective line in the former code list. long differenceTimeSpan = new TimeSpan(days,0,0,2 * seconds,0).Ticks;
-
I am very sure that these generated numbers are time based though. And for the build number it certainly works, I always get the correct date of when the assembly was build. Maybe there's a problem in my source code? However, if you would control the build number yourself, would you then do it manual, or could you think of a more automated way? I am fairly new to reflection and have no clue of how to influence the version of the build other than writing it manually in the AssemblyInfo.cs file. I am using VS 2003 EA. By the way, the time zone here is +01:00, so that wouldn't explain the time difference.
-
I don't get why the folowing is not working... the assembly with fileListerForm in is assigned a strong name and has a AssemblyVersion attribute of "1.0.*". It gets rebuilld and then executed. On startup I want to see the build moment (DateTime). System.Version version = System.Reflection.Assembly.GetAssembly(typeof (fileListerForm)).GetName().Version; int days = version.Build; int seconds = version.Revision; long startDateTime = new DateTime(2000,1,1).Ticks; long differenceTimeSpan = new TimeSpan(days,0,0,seconds,0).Ticks; DateTime buildTime = new DateTime(startDateTime + differenceTimeSpan); MessageBox.Show(buildTime.ToString()); The build number seems to be ok, because I arrive at the correct day. But the revision number seems to be too small. When I test at 19:00 for example, the revision number (that should give the amount of seconds since midnight) makes me end up somewhere in the morning (eg. 8:55)
-
As a test, I made a simple table in SQL where I have 3 fields: 1: id_field = int 2: name_field = nvarchar 3: picture_field = image When I fill a table in a dataset by using a dataadapter, all the data comes in. But when I bind the datatable to a datagrid, I only see the first two columns in the output, but not the pictures... Before I start coding further, does anyone know about a simple solution?
-
Hi, I was doing something with a dropdownlist, but - at least in my eyes - weird things happen. Whenever a user makes a selection from a dropdownlist, the listindex property of the dropdownlist is set to the LOWEST listindex with the same 'item-value' as the selection made. What I mean is the folowing... Suppose you have a dropdownlist with folowing items; text: item1 (value: 10) text: item2 (value: 20) text: item3 (value: 30) text: item4 (value: 40) text: item5 (value: 50) text: item6 (value: 20) Whenever a user selects item6, in the code behind the SelectedIndex property of the DropDownList reports 1, so the code behind is informed that item2 was choosen!!! I know that in HTML, values should be unique and that propably gives an explanation of what's going on. But in the Microsoft documentation under System.Web.UI.WebControls.ListItem you will find that listitems can be used as folows; But as stated, this would for a commercial website mean that when a customer want's to buy for example item10 that by coincidence also got the value "$1.99", item 1 would be ordered for him in stead...
-
Basically I have a dataset with a datatable of the folowing pattern; datetime value1 value2 value3 for example 2004/08/29 20:00:00 3.6 7.8 5.6 2004/08/30 21:00:00 5.5 3.3 2.5 2004/08/30 22:00:00 5.8 3.2 2.9 2004/08/30 23:00:00 8.5 3.3 2.2 I managed to display this data in a ASP.NET webpage using a chart on a Cystal Reports report. 3 lines are drawn in the graph, each with a different color, and Crystal Reports even draws a legend field for it. The problem I have lays in the x-axis! It should display datetimes, but when I got that working, Crystal shows to many of them! I mean, Crystal tries to do a good job, but the different datetimes are drawn over each other, when for example data is requed from a complete week, resulting in a blurry look with no relevant data readable. I would like to find a way to ask Crystal to only draw 12 datetimes - no matter what range for the data is picked - while all the datapoints are drawn. This means that when data for a complete year would be asked, only 1 datetime value could for example be drawn at the x - axis per month, while the lines on the graph are stil formed by all the data for each column (a value each hour).
-
launch my app on double click of certain file extensions
Kurt replied to Kurt's topic in Windows Forms
Thanx. How to capture the parameter in the code (the path to the file double-clicked)? And what did you mean with creating my own personal key Arch4ngel? -
Yes, but in that solution Form2 will only see an instance of Form1 as a legal parameter for the constructor. One could also use the parent class Form as expected argument type or, as above, a general object.
-
launch my app on double click of certain file extensions
Kurt replied to Kurt's topic in Windows Forms
Yes I would like some more explanation if you 're up to it. Like for example how to make the registery entries needed during installation or first run of the app... Cause I guess I 'll have to make some similar structure in the registry like the NotePad one. thanx in advance -
You could make a custom constructor for Form2, like public Form2(object caller) { InitializeComponent(); this.caller = caller; //caller is a private System.Object for the class } and than instantiate the new form by doing something like Form2 f = new Form2(this); f.Show(); this.Hide(); the next will than work... MessageBox.Show("Caller is " + this.caller.ToString()); Hope you can translate the code to VB.NET, otherwise post back but I avoid VB.NET when I can since I switched to C# ;)
-
Yes, integer division wil give you an integer that than implicitly is converted to a double (1.0). You should convert the integers first (Convert.ToDouble(700) etc...) or as mentioned add d or D as suffix to the integer number.
-
Hi, Like with for example MSWord, whenever a .doc file is dubbelclicked in Windows, Windows starts MSWord and probably the full path to the file is passed as an argument to MSWord as MSWord loads the file properly. I would like to create the same kind of functionality for my program. So I 'm basically looking for some way to connect my personal file extension(s) to my program when installed on a Windows (2000 - XP) machine, and for some way to let my app pick up the path to the file that caused the program to launch. Hope someone knows where to start or look at...
-
Ost, jeg er faktisk ikke dansker, men belgier... Bor i Denmark for 2 år nu
-
Yes, it works for me in the WHERE clause of a query ran against the SQL server. But what I have is a DataTable object filled with rows from the SQL table. let's say the content of the System.Data.DataSet.DataTable is; timestamp(DateTime) value(int) 2004/02/12 20:00:00 4 2004/02/12 21:00:00 8 2004/02/12 22:00:00 9 What I would like to do is for example; myDataSet.myDataTable.DefaultView.RowFilter = "timestamp = '2004/02/12 21:00:00'"; But then the value of; myDataSet.myDataTable.DefaultView.Count becomes 0! I could solve this for example like; int value = 0; bool found = false; foreach (myDataTableRow row in myDataTable) { if (row.timestamp == new System.DateTime(2004,2,12,21,0,0)) { value = row.value; found = true; break; } } But I 'm just looking for a way to work more directly by using the RowFilter property. Hope you can help me... I guess it has something to do how the XML DataSet represents the DateTime values internally (= as a string with timezone included). In that case it's probably a mather of making a methode that produces a string of that format when given a DateTime object. The solution I provided doesn't have the problem, the CLR knows that the timestamp field from the typed DataSet.DataTable should be casted to a System.DateTime object when referenced in the source code...