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
N

nzmike

@nzmike
About
Posts
81
Topics
39
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Finding a given day or weekday x months from today
    N nzmike

    Thanks for the input guys, it's appreciated. Luc, I have been using DateTime - you simply couldn't solve this without that class. Sorry if my post wasn't clear (though I thought I explained it pretty well) - I was looking more for a formula based on today, using DateTime to find out the day I wanted. Jon, Thanks for that suggestion - I didn't even think to use the Calendar class so will investigate that now. EDIT: I just looked at the Calendar class but you have to already know the day you want so it's not much use to me unfortunately. I do have it working quite nicely now via the loop method but, being a programmer, I just *know* there's a nicer, quicker, more efficient way to do it!

    .NET (Core and Framework) tutorial csharp testing beta-testing help

  • Finding a given day or weekday x months from today
    N nzmike

    Hi all, I've searched high and low and even found a few code project articles but nothing in C# and nothing that really does what I need which is to write some code to find a particular day in a month given an occurrence (which could be first, second, third, fourth or last) and a day type or name (which could be "weekday", "Monday", "Tuesday" ... "Sunday") and a number of months (1-12). I'm doing this as part of replicating the Outlook calendar recurrence dialog so users of my app can select custom dates to run reports. So, for example, they might want to run one report on the first weekday of each month, another report on the third Wednesday of every two months and maybe another one on the last Friday of each 3 months. My only starting position is that I have today's date which will always be the date the report has just run... from that I need to work out any combination of the above so I can then schedule the next occurrence of the report. I've tried doing it with some sort of formula but nothing I've tried works so at present I'm adding the months to today's date, setting the day to 1 then simply looping though testing each day until I find what I want - but it's pretty clumsy to be honest and getting the last occurrence is pretty tricky too. Are there folks out there that have better math brains than me that would know how to do this in a formula? All help and suggestions would be very welcome. Mike

    .NET (Core and Framework) tutorial csharp testing beta-testing help

  • How best to interact with a WinForm app over the web?
    N nzmike

    Thanks - they both sound like good alternatives... I'll have to do a bit of research. At the moment I am just doing it very simply where I write an event to a table from the web site then a timer in the app checks the table for any new entries every minute... seems to work well for what I need so far.

    .NET (Core and Framework) csharp database sql-server winforms wcf

  • How best to interact with a WinForm app over the web?
    N nzmike

    Hi all, I have a VB2.0 Winforms app that runs from about 9am until about 11pm every day analysing a live datafeed and then doing certain actions depending on the data. (It's an automated betting system for horse racing in case you're curious). What I want to be able to do is to have some semblance of control over the app via my web server for when I am not home but need to check on the app's status or feed it a certain command to change it's behaviour. (I don't need to see the app itself so I'm not looking for a VPN/VNC type solution). Since I also have my own web server I am thinking about building a private/secure web site which can read or write to the various SQL Server 2005 tables the app also uses. In this way I could interrogate data being created by the app (bets and results written to the DB) over the web (via stored procs run by clicking on links) and also issue commands via the website that could be written to another SQL table or XML file that the app could then check for, say every minute or so via a timer. To give a real example - sometimes the data feed needs a gentle prod to download the latest data (which I can request via an API in the app) so I could have a status page on the web that displays the last time of the downloaded datafeed and a button to tell the winforms app to request an updated datafeed. The app would then check the "Events" table every minute or so, see that a new command to refresh the data had come in and call that method in the datafeed API. (This is a pretty simple example - I have more complex things I want to do with an interface of this sort.) Given the app, the SQL DB and the web server are all on one machine is this the best way to do this sort of thing? Are there any nice .Net tools I don't know about to assist with this sort of (admittedly strange) type of remote interface? Should I be thinking about web services or just keep it simple and read/write SQL tables and/or XML files from both the app and the web site? TIA for any input, comments etc - just interested if anyone has any recommendations or can see any problems with doing this sort of thing. Mike

    .NET (Core and Framework) csharp database sql-server winforms wcf

  • Use Reflection to control winforms user permissions?
    N nzmike

    Thanks Pete - I really appreciate the reply... it gives me somewhere to start at least. Cheers, Mike

    Windows Forms csharp tutorial oracle winforms

  • Use Reflection to control winforms user permissions?
    N nzmike

    Hi all, I'm hoping someone who knows more about Reflection or the internals of the framework than me can help me out on this one. I'm working on a very large and complex winforms 2.0 in VB.Net 2.0. We will have quite a few different types of users (eg: Data admin, viewer, editor, business rules manager, etc) and I have been tasked with designing and implementing the security model that handles what each user can do. I intend to base it on our own in-house User, User Role and Permissions oracle 9i tables (ie: a pretty standard security model.) Someone suggested that rather than having a call to some method like SecurityModule.CheckUserPermission() in every method I could Reflection to find out what method was currently invoked (how?!) and then check the user permission against a table (loaded into memory) which would contain the user's role and therefore whether they had a right to use that method. For example the AddNewEmployee() method might only be available to the "DataAdmin" and the "HRAdmin" roles and all others would not be allowed to execute the method - it would just give them an appropriate dialog. So does anyone have any thoughts on how to do this? If the above idea is workable can someone point me in the right direction to get started? I've hardly ever used Reflection so am not sure how to go about designing this. Otherwise does anybody have any better ideas for a security model than having to place CheckUserPermission() calls all through this very large app? TIA for any help/info/suggestions. Mike

    Windows Forms csharp tutorial oracle winforms

  • Editing server-side Excel s/sheet in ASP.Net 2.0 Page - how?
    N nzmike

    Hi all, I have had what appears to be a very simple request from one of my clients - but am not sure how (or if) this can be done. Basically, they need to be able to let about 6-10 people access and edit an Excel 2003 spreadsheet from anywhere (ie: they could be inside or outside the corporate intranet) and my idea was to allow them to do it through an ASP.Net 2 web page. This means the s/sheet would always reside on the server but could only be edited by one person at a time (which is what the client wants - if it's open for edit all other users will be told the s/sheet is not available - or perhaps they can just view it but not save it.) So how do I go about this using VS2005 and ASP.Net 2? Is it just a matter of having an tag in the HTML or is there a better, easier or more advance way to do it? I've googled quite a bit for this and found lots of pages about importing or exporting Excel data but I want to edit & save the s/sheet in place and I can't find anything about that. TIA for suggestions or feedback. Mike

    ASP.NET question csharp html asp-net sysadmin

  • A "WinForms Development" forum *PLEASE*!
    N nzmike

    Glad to be of help :) So when do you think we'd be likely to see that forum being added? Cheers, Mike

    Site Bugs / Suggestions csharp question dotnet winforms

  • BindingSource setting RowState.Modified on unchanged rows! [modified]
    N nzmike

    I have a VB.Net 2.0 app with a readonly DataGridView and a BindingSource and BindingNavigator which allows the user to edit, add and delete rows via my own custom controls (combobox, textbox etc). The table to edit is read in successfully then bound to (and displayed in) the DGV and I can do all the BindingNavigator stuff like editing fields from selected rows and adding/deleting rows as you'd expect. The problem I'm getting is that if I click on a row in the DGV but do not make any changes it is still marked as being changed (ie: RowState = Modified). I would have expected that only the rows that actually changed would have this status - otherwise what's the point? So I guess my question is why is the BindingSource (or BindingNavigator or DGV?) setting these unchanged rows to Modified and how can I stop it from doing that or tell which rows have genuinely changed data? Hope someone can help as this one has me stumped! Mike -- modified at 23:15 Monday 15th January, 2007

    Database question help csharp

  • A "WinForms Development" forum *PLEASE*!
    N nzmike

    Something that has always annoyed me about the CodeProject forums is the lack of a topic specifically for WinForms development. There is a "Web Development" topic , a ".Net Framework" topic and all the of language-specific topics but nothing relating directly to WinForms development. So when I have a question on WinForms I never know where to post it... I don't care what language I get the replies relating to (I speak both C# and VB.Net) so posting in a language forum is a waste of time - but on the other hand posting in ".Net framework" is too vague - where WinForms questions should *really* go IMHO is in a language independant WinForms topic - you have a "Web Development" topic so why not a WinForms topic? Otherwise I love the site and everything about it! Mike

    Site Bugs / Suggestions csharp question dotnet winforms

  • Popup Panel on custom control does not appear - any ideas?
    N nzmike

    I have a VB.Net 2.0 custom control which allows me to pick a date and a 24 hour time. The control consists of a standard DateTimePicker to select the date and for the 24 hour time a textbox (txtHours) to display the selected hour, a label (lblSelectHours) which consists of an image of the standard dropdown icon and a Panel object. When the user clicks on the dropdown label the Panel, containing one button for each of the 24 hours in a day, should pop up. However, the panel is nowhere to be seen even though I know the label's Click event is firing. I am pretty puzzled about this as the popup panel for the standard DateTimePicker in the control appears perfectly. The Panel object is defined in the control as being off the main area being displayed but when the user clicks the dropdown arrow (the label) the event handler below should set the correct position to appear and set Visible to true: Private Sub lblSelectHours_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lblSelectHours.Click pnlHours.Left = Me.Left + txtHours.Left pnlHours.Top = Me.Top + txtHours.Top + txtHours.Height pnlHours.Visible = True pnlHours.BringToFront() End Sub So does anyone know why my popup panel won't appear? If I copy the various components of the control and just put them on a form (ie: without the use of a custom control) the panel appears fine with this same code. TIA for any help... Mike

    .NET (Core and Framework) csharp help question

  • How to auto upgrade the XML files at the time of software upgradation ??
    N nzmike

    I'm assuming zxc89 means that when the app starts on the user's machine it would contact a web server to look for a newer version of the app then download the updated version including the updated XML files... this is what I need to do in my app as well so I'd also like to know what the options are for doing this. If this is not what you mean zxc89 then you need to tell us what you mean! Mike

    XML / XSL csharp xml tutorial question

  • How to load XML objects into .Net classes [modified]
    N nzmike

    Thanks - what I did in the end was read the file into an XMLDataDocument object instead of a class structure as it means I can use XPath/XQuery and also have the power of the DatatSet object as well. Once I created the schema file (by loading the XML file into VS2005 and choosing Create Schema from the XML menu) the code was simply as follows: Public Sub LoadXMLConfig() 'Read the XML configuration file dataDoc = New XmlDataDocument() dataDoc.DataSet.ReadXml(My.Settings.XMLConfigFile) End Sub Just thought I'd post this in case anyone else is wanting to do this sort of thing and comes across this thread. Mike

    XML / XSL csharp database xml oracle

  • How to load XML objects into .Net classes [modified]
    N nzmike

    Hi all, Hoping someone can point me in the right direction here. I'm writing a VB.Net 2.0 WinForms admin app to allow users to do maintenance on an Oracle database behind another very large app. To keep the size of the admin app down and to avoid a maintenance nightmare when the tables (about 70 of them) change I am trying to write it so it's totally automated. I already have code to read the schema of each table to get the columns and then I have a form that adds an appropriate custom control for each type of table column. This works very well but I need it to be advanced enough to hide some columns, make sure others are entered, validate some others, etc, etc. So my idea is to have an XML file (see below) containing the tables and columns which can be maintained and when the app starts it would read the file and load the data into .Net classes which correspond to the XML (see class definitions below). I can then use these table and column classes to apply custom behaviour to the custom edit form I already have. So, looking at the XML and class definitions (both kept VERY simple for illustration purposes) can anyone tell me how best to go about this? How could I best read the XML file in and convert it to the classes I've defined? TIA for any help... I know how to write using lots of fairly manual code but am hoping there is a smarter & quicker way to to do this. Mike.

    Public Class SAMTables Public Tables() as SAMTAble End Class Public Class SAMTable Public TableName as String Public CustomForm as String Public Columns() as SAMColumn End Class Public

    XML / XSL csharp database xml oracle

  • Controlling session time in WinForms app - best approach? [modified]
    N nzmike

    Thanks - can you give a little more detail though... how do I go about actually doing this?

    .NET (Core and Framework) question csharp help winforms

  • Controlling session time in WinForms app - best approach? [modified]
    N nzmike

    We have a Vb.Net 2.0 WinForms app that we force our users to log into using their network credentials (via LDAP and ADS). The app allows access to a lot of sensitive information so want to automatically log the user out after a certain time of being inactive (just like you can do on a web form) and then make them log in again to continue - so my question what is the best method in .Net 2.0 for doing this? I looked in System.Security but I can't find anything obvious there and a google didn't turn up anything useful either. I hoped I could test some sort of Form.IsAuthenticated proeprty as in a web app but this does not appear to be the case. (BTW, we don't want to quit the application when a user times out - rather, we'll just set the entire form to be disabled until they log in again.) Currently what I've done is added a timer to the form and when the user logs in I set the timer's Interval to the number of milliseconds (from the app.config file) that they are allowed to remain logged in when inactive and then call timer.Start(). The problem with this method is reliably resetting the session (by stopping and re-starting the timer) when they do some action (such as clicking a button or entering text etc) - I tried catching Form events such as MouseDown, MouseClick and a few others but if the user clicks a control (eg: a label, textbox, button etc) and not directly on the form's surface itself these events don't get fired which can lead to users getting logged out even when they're using the app... which is clearly not the desired result! So can anyone tell me the best way to go about doing this using .Net's security model instead of the above method? TIA for any help/advice... Mike -- modified at 17:40 Tuesday 12th December, 2006

    .NET (Core and Framework) question csharp help winforms

  • Prevent DataGridView selecting a row - is it possible?
    N nzmike

    Thanks Leah.... actually I'm not sure why I even posted the question as I realised soon after all you need to do is say datagridview1.SelectedRows(0).Selected = false and that takes care of it. What I want to do now is only highlight a row when the user clicks on one but rather than using a background colour (which obscures my cell traffic-lighting) I want to leave the B/G and F/G colours as they are and instead draw a 2-pixel red border around the entire row - and I'm thinking the only way to do that is to override one of the Paint methods... anyone know of a better/simpler way?

    Visual Basic algorithms help question

  • Prevent DataGridView selecting a row - is it possible?
    N nzmike

    Hi all, I have a sorted, non-editable DataGridView which contains some cells in each row that are traffic-lighted (ie: they have a different b/g colour depending on value) but when I populate the control the row that was the first one (before sorting) is always highlighted thus wiping out my custom coloured cells. I have tried every combo of colours and highlighting options to try and stop the DGV doing this but can't find a way. Ideally I just want to suppress altogether the DGV control selecting a row when it populates - does anyone know how I can go about this? This is driving me mad so I hope someone can help! TIA... Mike

    Visual Basic algorithms help question

  • How do you update automatically created strongly-typed datasets? [modified]
    N nzmike

    This one is driving me mad - hope someone can help. I have a VB.Net app in VS2005 and I wanted to bind it to a SQL Server 2005 table so I dragged a DataGridView control onto a form and defined the datasource to come from the table I want to use and VS2005 went ahead and generated the XSD and the screeds of code which is great. I then refined my table (using SQL Server Studio, not VS2005), adding a new column and changing a couple of column types in the DB table but I can't see ANY way to get VS2005 to get the updated table except to trash the generated Dataset, BindingSource and TableAdapter objects and do the whole binding exercise all over again! I've tried right-clicking and doing a refesh wherever I can that option but it never updates the code behind or the XSD. Now, I seem to remember in VS2003 there was a "Regenerate" command (or something like that) so where the heck is the equivalent in VS2005? Right-clicking on the XSD file in solution explorer has an option "Run custom tool" which I think runs "MSDataSetGenerator" but it doesn't seem to refresh or regenerate anything! I've searched high and low and looked everywhere but I can't see any way to keep the VS2005 table concurrent with the underlying DB table - surely with the integration of SQL Server and .Net 2.0 I'm not expecting the impossible? Can someone help me out here and tell me what I'm missing? TIA... Mike -- modified at 18:00 Saturday 4th November, 2006

    Database database csharp sql-server wpf

  • Persisting expanded/collapsed state of TreeView - how?
    N nzmike

    Hi all, I have a TreeView control in a C# ASP.Net 2.0 project and (so far) have not been able to work out how to persist the state of the expanded/collapsed nodes between postbacks. At present, whenever the page comes back from a postback all nodes are expanded instead of just the ones the user physically expanded. Is this functionality available as part of the standard treeview or does the developer need to write it? I found Tom John's article (http://www.codeproject.com/vb/net/TreeViewDataAccess.asp) regarding serializing the state of the TreeView but I still find it hard to believe the ASP.Net control does not cater for this in some way itself.... am I missing something simple? TIA for any help/suggestions etc. Mike

    ASP.NET csharp asp-net com help tutorial
  • Login

  • Don't have an account? Register

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