15,885,143 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by Gary Heath (Top 122 by date)
Gary Heath
24-Nov-20 10:02am
View
Cheers Ralf, I had to Google how to use the WindowsState option but by coding it like this "Form1.WindowState = FormWindowState.Minimized", it works :-)
Gary Heath
24-Nov-20 7:51am
View
If I put "Form1.WindowState.Minimized" straight after the line "WordDoc = WordApp.Documents.Add(MusicFolder & MusicFile)" I get an error : "Expression is not a method" :-(
Gary Heath
24-Nov-20 7:40am
View
Ralf ... Form1 has a ComboBox that is loaded with 3 options for the user, (1) Open an existing file, (2) Create a new Portrait File, (3) Create a new Landscape File. Form2 opens if option 2 or 3 is chosen.
Form2 just contains a TextBox for the user to enter the name of his Artist or Band and the code I have supplied is the Code that sits behind Form2. Form3 is an Error box so can be ignored.
If option 2 or 3 is selected to create a new document, I create a new Word document in the Orientation he has requested and open it for him to enter data ... this all worked fine when I was opening an Excel file, I have just realised, but now I have switched it to a Word file, Form1 pops up in front of Word and that is all I want to prevent.
This is just a small program for an old man who has brain damage I am trying to make it easy for him to do what he wants to do, it's so frustratingly annoying to run into such a stupid problem when it's basically finished !!!
I think I looked at WindowState yesterday, but I may not have, there are so many thousands of options and combinations I may be mistaken ... I'll look at it again now ...
Gary Heath
24-Nov-20 5:57am
View
I can only find SetTopLevel and if I set that to False I lose visibility of the Form completely !!
Gary Heath
25-Jan-18 8:32am
View
Well spotted CHill60 ... I knew it had to be something simple / stupid but I've looked at it for 2 days straight and couldn't see it !!! Thank you, doh, I feel a right Klutz now !!!
Gary Heath
7-Jan-18 8:51am
View
Thanks Griff
Gary Heath
7-Jan-18 8:50am
View
OK, it looks like I have done something wrong here, the Column I am entering 1 into in Leagues, to pick up Id=1 from the LeagueTypes Table isn't referenced in the Foreign Key statement ... I've never used VS in this way before, I've obviously got some more learning to do !!!
Gary Heath
7-Jan-18 8:43am
View
But why did the first 3 Rows go in just fine ?
Gary Heath
19-Sep-17 7:20am
View
It's not my VBA, that works fine, it's getting Outlook to run it properly ... all I want to know is if there is a viable alternative to Outlook, an E:Mail program that offers a similar option to run self-written programs in the background, either VBA (which I doubt) or an alternative language ?
Gary Heath
21-Mar-17 11:24am
View
As I said to CHill60, Richard, I tried Goto 0 & Goto Next, it just dropped out of the routine and the Recordset was closed / didn't exist in my logic ... this was because the Connection to the Database was obviously being reset somewhere, but I don't know where. I have now closed it at the end of the previous Module and Connect again at the start of this Module & that works OK.
What I do not understand is why the program will process the lines ...
Set KA_RS_League = New ADODB.Recordset
If KA_RS_League.State = adStateOpen Then KA_RS_League.Close
... without a Connection, regardless of the Goto I was using, I was getting no error message or code, just an "Out of Context" message in the Watch.
Still all sorted now, cheers :-)
Gary Heath
21-Mar-17 10:47am
View
I have tried Goto 0 & Goto Next but it didn't tell me anything, what I meant by my comment was that if there is no Connection to the Database to where I am creating a Recordset, why does it not report that, under any of the Goto options ?!?
Gary Heath
21-Mar-17 10:44am
View
Ahh yes, it only appears when my cursor is over it so didn't spot it !! Will try to remember in future ...
Gary Heath
21-Mar-17 5:59am
View
It makes very little difference, instead of the next statement being the End Sub, it is the line following the call to this module :-(
Is there not a variable somewhere that holds the result of the statement ? If so what / where can I find it ?!?
Gary Heath
7-Mar-17 16:22pm
View
Thank you
Gary Heath
7-Mar-17 16:22pm
View
Thank you
Gary Heath
31-Jan-17 9:26am
View
I will look at this, cheers :-)
Gary Heath
31-Jan-17 6:22am
View
Thanks for replying but that says my account will only last for 30 days and will then be deleted !
Gary Heath
14-Mar-16 19:08pm
View
I have actually abandoned this idea now, Dave, thanks for your help though, I have accepted your answers :-)
Gary Heath
10-Mar-16 9:24am
View
Philippe, apart from the fact this problem is closed (although not resolved), if you had opened the link that is supplied, you would see not only the code, but also, as it says in the original post, the file being edited !!!
Gary Heath
7-Mar-16 11:22am
View
The L: Drive is set up by Lima's own software, I don't map anything in the program or on either PC, the Lima installed software controls that, and in the program every file is accessed the same way ... These 2 files are in the same Folder on the L: Drive ...
Dim myDataFolder As String
myDataFolder = "L:\Kickabout\Newsletters\Application Files\"
Dim myXml1 As XmlTextReader = New XmlTextReader(myDataFolder & "Email Schedule.xml")
Dim myXml2 As XmlTextReader = New XmlTextReader(myDataFolder & "NewsLetter Items.xml")
Do While (myXml1.Read()) <<<< This file is found OK
If myXml1.IsStartElement() Then
If myXml1.Name = "Session" & mySession Then
myXml1.Read()
myArrayLen = Len(myXml1.Value)
For Ix = 0 To myArrayLen - 1
If myXml1.Value.Chars(Ix) = "Y" Then
myItem = "Item" & (Ix + 1).ToString
Do While (myXml2.Read()) <<<< This file is NOT found
If myXml2.IsStartElement() Then
Gary Heath
7-Mar-16 10:36am
View
Andy (or anybody else who reads this, obviously !), I wondered if the problem may, for some reason, be caused by the accessing of the file being in a Function, so I have moved the code out of the Function and into the stream of the program. I am getting the same problem, but in the attached picture, you can clearly see that there are 2 files accessed here, they both exist in the same Folder on the L: Drive but it crashes when trying to find the second one !!!
http://i63.tinypic.com/e0o7ic.jpg
Gary Heath
7-Mar-16 10:04am
View
I've just been looking into mapping the drive when something utterly bizarre hit me ... the actual program that I am running is on the L: Drive !! There are also a number of other files that are on the L: Drive that are all accessed perfectly OK until it gets to this file, where it crashes with the Not Found error !!!
Gary Heath
7-Mar-16 7:20am
View
This is something I wrote to run on my Desktop, Andy, but have migrated it to the Lima so that I can run it from either my Desktop or my Laptop, so the user will change, depending on which machine I am using (My name is the same on both machines and I am an administrator on both, but I assume when you say "user specific", that takes the machine into consideration). I imagine I am going to run into a number of problems like this then :-(
Thanks, I will let you know if this resolves the problem ...
Gary Heath
28-Feb-16 9:01am
View
I haven't looked at this for a couple of days, Dave, I've not just disappeared :-) ... will let you know how I get on.
Gary Heath
25-Feb-16 14:51pm
View
That line with all the quotes I got online, baffling isn't it :) ... that's why I tried to do it without the quotes and yes, I am just experimenting so I am not surprised there are a multitude of errors / problems !!!
I am a programmer by trade, COBOL, so love trying to work all this stuff out but when you get error messages like "File Not Found" but the message doesn't tell you which file isn't found, I get angry, I get upset and I despair at the standards of the programming these days ... without people like yourself it just wouldn't be worth bothering !!!
I have had a couple of beers now and am just going to watch the football on TV so will give this a try tomorrow and let you know how I get on, thank you very much for all of your help :)
Gary Heath
25-Feb-16 12:31pm
View
Thanks Dave, the reason I couldn't get the PSEXEC format right was because I was inside the VBA program !!! I still get problems though, it's now giving me error 53, File Not Found using the following code ...
Sub ExecuteOnOtherMachine()
Dim strPCName As String
Dim strProgramName As String
Dim strArgument As String
strPCName = "\\Gary-PC "
strProgramName = "C:\Program Files\PS Tools\PsExec.exe "
strArgument = "\\GARY-PC\GaryPC - O\CloseOutlook.vbs "
Call Shell(strPCName & strProgramName & strArgument, vbNormalFocus)
Call Shell("""" & strPCName & """ """ & strProgramName & """ """ & strArgument & """", vbNormalFocus)
End Sub
... Both the Script commands give the same result & also if I change the strArgument to O:\CloseOutlook.vbs (so it's the actual address on the PC without the Network path) it still gives the identical error :-( ... this is driving me mad !!!
Gary Heath
25-Feb-16 9:54am
View
Well I don't need any interaction, I just need to trigger the Script to run, and according to numerous articles this is perfectly doable, except I can't get anything to do it as I am constantly getting Permission Errors.
I have now tried PSexec in PStools, but I can't get it to run because I can't get the structure of the command right, so have tried Powershell, which looks and acts superb, but having set the first part of it, I am again getting Permission Errors !!!
Set-Item : Access is denied.
At line:1 char:9
+ Set-Item <<<< wsman:\localhost\client\trustedhosts Gary-PC
+ CategoryInfo : NotSpecified: (:) [Set-Item], InvalidOperationException
+ FullyQualifiedErrorId : System.InvalidOperationException,Microsoft.PowerShell.Commands.SetItemCommand
Gary Heath
23-Jan-16 12:40pm
View
It was quite clear but with new tests I have now rewritten the question anyway.
Gary Heath
23-Jan-16 12:25pm
View
Well this is helpful, five stars for the solution which is basically "use google" and doesn't help one bit as there is no answer to be found there, so isn't a solution in any way, shape or form, just brilliant !!!
Gary Heath
23-Jan-16 8:46am
View
You don't think I had the sense to try that before posting in here, then Richard ?
Gary Heath
13-Jan-16 2:04am
View
Thanks Dave, so in essence, Publish is just a poor Installer ?!? I will take a look at those, would you recommend one above any of the others ?
Gary Heath
12-Jan-16 18:06pm
View
Why do I care what an UNinstaller will do ? I want my Client / User to Install it and have a shortcut on his desktop (or wherever he wants to move it to) ... he is pretty computer illiterate, like most end users ...
Gary Heath
12-Jan-16 17:30pm
View
You are really confusing me here Sergey ... this is as straightforward as it can possibly be !!!
1) I have written a Windows Form VB.net program in VS2015.
2) I want to send it to my client / user, I can do that by E:Mail, on a USB stick, via Teamviewer, it really doesn't matter, I need him to have it on his PC.
3) Then I want him to be able to Install it and it ask him where he wants it and if he wants a shortcut.
That's all I want to do and I, quite understandably I think, assumed that is what the Publish option did !!!
Gary Heath
12-Jan-16 17:09pm
View
Sorry I am slow replying, I was watching the football :-) ... It's a very basic Windows Form program written in VB ... On this PC if I Publish and run Setup it just opens the program (well, after a little visual show !), I don't know where it has Installed it, if at all.
Nobody has told me anything, I just used Teamviewer to copy the Folder where I have Published it from this PC to onto my Laptop and ran Setup on there, it created a Folder and a Shortcut to the Executable on the Desktop, and again opened the Program, that's obviously not what I want, as I said (sorry to repeat) I just want my User to be able to Install the program the same way as we all install programs and that's why I am confused (I have never done this before, obviously :-) !!!) ...
I suppose more than anything I am confused and bewildered as to why there is this option to "Publish" in Visual Studio that doesn't really actually appear to be of any use at all !!!
Gary Heath
12-Jan-16 15:49pm
View
I'm sorry Sergey, I don't understand. Once I have a fully working VB program I assumed that I need to "Publish" it ... is that not the case ? I, personally, can execute the program from inside VS2015 or direct by creating a Shortcut, but my User can't do that, I need to send him something that he can run and it says "Where do you want to install this program", "Do you want to create a Shortcut on the Desktop" etc., etc. ... I assumed that was what the "Publish" option did, but it quite clearly doesn't :-( !!!
Gary Heath
11-Jan-16 6:38am
View
Thanks again :-)
Gary Heath
11-Jan-16 6:00am
View
I've cut & pasted your help as the Answer and credited you, but not sure if / how you can take the credit properly ?!?
Gary Heath
11-Jan-16 5:53am
View
Mika, you're a star, thank you ... I had to remove the "Set" as "BC30807 'Let' and 'Set' assignment statements are no longer supported." but apart from that absolutely perfect, have a virtual Stella Artois on me :-) !!!
Gary Heath
10-Jan-16 17:04pm
View
Thanks Michael but when I work on my actual document & finish it, I do close it & E:mail it away ... it's all these other instances that are the problem !!
Gary Heath
10-Jan-16 16:56pm
View
Mika, that worked, thank you, so the "New" in that line actually executes an instance, even though it's on a Dim statement !!! I really should try to learn this stuff in a bit more depth but at 57 with 4 kids in the house is ain't easy !!!
OK, it now fails with "An unhandled exception of type 'System.NullReferenceException' occurred in KA_Newsletter.exe
" ... I am assuming I have to start a NEW occurrence when I get to the following code, but I've had a few beers so will look in the morning ... in the meantime, thank you & this is where it falls over in case you feel like saving me some time :-) !!!!
'Open Word Newsletter, or switch to it if it's already open
Dim myFileOpen As Boolean
myFileOpen = IsFileOpen(myNewsLetter)
If myFileOpen = False Then
myMSDoc = myMSWord.Documents.Open(myNewsLetter) <<< Fails here
myMSWord.WindowState = Word.WdWindowState.wdWindowStateNormal
myMSWord.Visible = True
'myMSWord.ActiveDocument.Bookmarks("\StartOfDoc").Select()
End If
Gary Heath
10-Jan-16 13:37pm
View
I am just going to eat, thank you, I am no expert in this so your advice is invaluable, I will look, test and report back later :-) ... thanks Mika ...
Gary Heath
10-Jan-16 13:36pm
View
It's a Windows Forms project originally written under VS2010 but now I am using VS2015 ... I am using Office 2007 and this is a recently (this week) rebuilt Windows 7 x64 Home Professional machine.
Gary Heath
10-Jan-16 13:23pm
View
When I use "Debug / Step into" with Task Manager running alongside, the WINWORD.EXE *32 instance opens almost immediately.
Opening Project Properties & looking at the DEBUG tab it says "Configuration : Active (Debug) & Platform : Active (x86) ... everything else is blanked out and the only things that are "chosen" are Start Project and Enable the Visual Studio hosting process.
Gary Heath
10-Jan-16 13:07pm
View
These are my Imports and variable definitions ...
Imports System.IO
Imports System.Text.RegularExpressions
Imports System.Xml
'Imports Microsoft.Office.Core
Imports Microsoft.Office.Interop
'Imports Microsoft.Office.Tools.Word
Imports System.Windows.Forms.VisualStyles.VisualStyleElement
Imports System.Windows.Forms.Form
Imports System.Runtime.InteropServices
Imports System.IO.Compression
Imports System.Reflection
Imports Ionic.Zip 'Used to UnZip files, see http://dotnetzip.codeplex.com/
Imports Microsoft.VisualBasic.FileSystem
Imports System.IO.StreamWriter
Imports System.IO.TextWriter
Imports Outlook = Microsoft.Office.Interop.Outlook
Public Class Form1
Dim myProgramAborted As Boolean = False
Dim myFolder As String
Dim myTempFolder As String
Dim myDataFolder As String
Dim myNlFolder As String
Dim myTemplate As String
Dim myNewsLetter As String
Dim myTables As String
Dim myLeftCB As String
Dim myRARfile As String
Dim myLeague As String
Dim mySession As String
Dim myLastSession As String
Dim mySessionMinusOne As String
Dim mySessionString1 As String
Dim mySessionString2 As String
Dim myArray(,) As String
Dim myItem As String
Dim myCount As Int16 = 0
Dim myMSWord As New Word.Application
Dim myMSDoc As New Word.Document
Dim myArrayLen As Int16
Dim myWordData As String
Dim myWordHeading As String
Dim myWordLine As String
Dim myBlankLine As Boolean
Dim myCupRound As String
Dim myCupMatches As Int16 = 0
Dim myCupDraw As Int16 = 0
Dim myLeagueCupRound As String
Dim myLeagueCupMatches As Int16 = 0
Dim myLeagueCupDraw As Int16 = 0
Dim myTrophyRound As String
Dim myTrophyMatches As Int16 = 0
Dim myTrophyDraw As Int16 = 0
Dim myChampsTrophyRound As String
Dim myChampsTrophyMatches As Int16 = 0
Dim myChampsTrophyDraw As Int16 = 0
Dim myIntlRound As String
Dim myIntlMatches As Int16 = 0
Dim myCupCount As Int16 = 0
Dim myZipFolder As String
Dim myWriterTxt As String
Dim myAsciiTxt As String
Dim myNewResults As String
Dim myAucResTxt As String
Dim myNewsTabTxt As String
Dim myNewTable As String
Dim myNewTableTemp As String
Dim myStatfileTxt As String
Dim myTestRtf As String
Dim myTranstxt As String
Dim myScorers As String
Dim myInTxt As String
Dim myLineWanted As Boolean
Dim myOutLine As String = ""
Dim myOutFile As StreamWriter
Dim myNickNameFile As String
Dim myNotePadNum As Int16 = 0
Dim myNotePadFiles(15) As String
Dim myId As Int16
Dim myIdFile As String
Dim myErrorMsg As String
Dim myMessageBoxStyle As String
Dim myDiv As Int16 = 0
Dim myLine As Int16 = 0
Dim myFixturesTxt As String
Dim myAllTeamsTxt As String
Dim myEuroSpielTxt As String
Dim myOLrecipient As String
Dim myOLsubject As String
Dim myOLbody As String
Dim myLastNewsletter As String
Dim myAllTeamSess As String
Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
'Define file paths
myTempFolder = "K:\Newsletters\Newsletter Templates (Email)\Ribbon\"
myDataFolder = "K:\Newsletters\Application Files\"
myNlFolder = "K:\Newsletters\"
End Sub
Gary Heath
10-Jan-16 13:05pm
View
I put a break on the very first line, before it's even done anything (that I have written) "Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load" ... and the Word instance has started !!!
Gary Heath
9-Jan-16 9:37am
View
I really don't know Michael, this is code that I got from the Internet about 5 years ago and has always worked. I have upgraded to VS2015 & this happens ... as I just said to Richard, above, I'm not a professional in this, just a dabbler.
Gary Heath
9-Jan-16 9:35am
View
It's not clear to me though, hence my question. I dabble in this stuff, I am far from an expert ...
Gary Heath
31-Mar-15 15:02pm
View
I'd forgotten all about that, I did it and it works perfectly, thanks RyanDev :-) !!!
Gary Heath
26-Mar-15 12:36pm
View
Brilliant, thank you :-)
Gary Heath
3-Jul-14 6:39am
View
Brilliant, thank you, I do love the clear and obvious Error Messages Microsoft display !!!
Gary Heath
28-Jun-14 7:44am
View
Brilliant, thanks goathik :-)
Gary Heath
26-Jun-14 9:18am
View
Philippe Mori - Changing the font does indeed resolve the problem, thank you ... strange though when there is so much free space reserved around the button that opens the Calendar !!!
Gary Heath
26-Jun-14 9:11am
View
CHill60 - I am using Visual Studio 2010 & it's a basic Windows Form. How do I get at that code ?
Philippe Mori - I will try a different Font and see if that helps.
Gary Heath
30-Jan-14 15:02pm
View
Sorry, I've been out and about for the past 48 hours, as far as I know, that Cell contains the letter "P" but I can't prove that because even MsgBox gives me the same error !!!
Gary Heath
29-Jan-14 12:19pm
View
This is what I was wondering but I don't see where that particular page helps. I tried the Cstr(myCell.value) command but it made no difference :-(
Gary Heath
22-Jan-14 18:49pm
View
I am actually off to bed without checking your link, Christian, I'll take a look in the morning, BUT ... I haven't used any SQL commands, that is why I am confused and a bit lost ... all I have done to read the data is use these .FILL commands, there is no SQL in my program !!!
Gary Heath
22-Jan-14 11:56am
View
Yes, you are right, of course, Christian, but this is a very small application that I just need to get working ASAP & I will be updating my naming very soon ... the reason I haven't been strict at this point in time is because this is my third different attempt at doing this and I have wasted so much time over the past 2 making sure my names are right and then having to (well, CHOOSING to) start again that I decided I would get the basics working first !!!
Previously I have accessed my databases by having a ConnectionString and passing SQL statements, somebody suggested I use this method, as it automatically updates my ComBobox & Data Tables and I have to say, for READING of the database it is simplicity itself. However, this is where I fall foul of a lack of understanding which prompted the question above, using this method, how do I WRITE to the database ?
Gary Heath
21-Jan-14 10:09am
View
onenomi, it may have been as simple as that !!! I thought I had rebuilt it ... I've saved it, Closed the Project, re-opened it, tried everything, that's why I was getting so frustrated, maybe I hadn't done a Re-Build, because I just did one and lo & behold, there it is !!!
Thank you, I was sure it had to be something simple / stupid, that's me all over :-) !!!
Gary Heath
15-Jan-14 12:52pm
View
Thank you ...
Gary Heath
15-Jan-14 10:23am
View
That's interesting, I'll take a look, thank you ... I don't suppose you have a link to a small example of an application working like this, do you ? I always find it easier to understand something when I can see it in action ... I'm a mainframe programmer (COBOL) by trade and VB.net programming is so alien to what I am used to :-) !!!
Gary Heath
7-Jan-14 13:46pm
View
Thank you, I still have trouble understanding most of this stuff, but I got it working :-)
Thanks again ...
Gary Heath
31-May-13 8:48am
View
So there is no restriction or "best practice" when it comes to using Javascript ?
Whenever I see Javascript discussed, there is always mention of web pages, but is that just because it is being discussed for use in the public domain, as opposed to my use here, which is for private use ?
Gary Heath
28-Feb-13 12:33pm
View
Thank you Sergey, but in this case it is not for Users, it's only for me and I want to be able to see the whole layout, because one of the columns is a date and I can see where I stand with each row. It is much like a Menu & it links me to a comprehensive detailed screen for that selection.
It is all colour-coded as well, that is where keeping track of all the TextBox numbers first gave me problems, the main reason I want to avoid it this time around :-) !!!
Gary Heath
28-Feb-13 11:10am
View
How about you go and Troll somebody else, I've got some help from another forum, one without smart-arse idiots giving me pointless answers ...
Shame, this place normally has some helpful people on it ...
Gary Heath
28-Feb-13 10:45am
View
But you Googled DataGridView ... the whole point of my question is that I don't know which method to use, that's why I ask on sites like this, so that people who DO know can help me !!! I could Google all day log, but it's going to get me nowhere if I don't know what to Google !!!
Gary Heath
31-Jan-13 7:15am
View
Yes, Notepad++ is an editor, BUT you CAN write scripts in it using PHP, Python & Ruby amongst others ...
Gary Heath
30-Jan-13 10:45am
View
So simple !!! Thank you CHill60 ...
Gary Heath
30-Jan-13 9:55am
View
I want to use PHP scripting in NotePad++ and would like to see a basic example of how other people do it as I don't know where to start ...
Gary Heath
15-Jan-13 14:16pm
View
Yes, this was exactly the problem !!! I was updating the XML data tab within VS2010, but that isn't the file that gets read in debug mode !!!
A bit stupid if you ask me, but thanks for spotting it ... much appreciated.
Gary Heath
15-Jan-13 13:49pm
View
Sergey, I see what *may* be the problem, I will experiment ... I created an XML file from within VS2010 as part of my Project & I then had to copy that file to my Debug folder. Thanks to you saying that I realised that I may have a problem and it seems that if I change the data in VS2010 in my XML file, this is NOT the same data as in the debug folder ... I have to change that independently or it goes out of step, and I have NOT done that !!!
It seems a bit odd to me that VS2010 would work like that, but it is what it is I suppose !!!
I will let you know if the changes make a difference ...
Gary Heath
15-Jan-13 13:44pm
View
Do you mean the first line ? VB.net creates that line so I guess it's OK !!!
Gary Heath
4-Dec-12 17:46pm
View
Oh yuk !!! Thanks, I will keep looking & experimenting, it doesn't make sense that this can't be done !!!
Gary Heath
4-Dec-12 15:47pm
View
Yes, I got the Docking bit & I am experimenting with AutoSize & AutoSizeMode, but I can't get it to resize as I want. If I have AutoSize set to True & AutoSizeMode set to GrowAndShrink it always opens as a tiny little window, whereas if I have it as grow only, it doesn't seem to change size ... weird !
Gary Heath
4-Dec-12 14:32pm
View
Just a thought, is there a way, therefore, to make the Form itself, shrink (or grow if necessary, to perfectly fit the re-sized Columns ?!? I guess there must be ... I'll start looking ...
Gary Heath
4-Dec-12 14:06pm
View
Perfect, thank you
Gary Heath
25-Oct-12 18:19pm
View
Magnificent reply, and yes, I can see how powerful that could be. As I mentioned in my original question, the obvious way to do something like this is looping & finding, looping & finding and it could take ages in comparison to something like what you did ... thank you very much for the answer & the explanation, I am truly impressed :-) !!!
Gary Heath
25-Oct-12 13:25pm
View
That works, brilliant ... any chance you can explain what it's doing, how & why it works ?!?!?
Gary Heath
18-Sep-12 18:24pm
View
Whilst I appreciate that you are trying to help, I do not understand why this would help ... it's a fully working program (in Outlook 2007) on a perfectly working E:Mail system (with no problems) ... however, I did it and it made no difference ...
Gary Heath
18-Sep-12 16:46pm
View
The error occurs on the line where I have written "<<< The Error occurs on this line" !!!
Gary Heath
7-Sep-12 2:33am
View
Thank you Peter, but what I really don't understand is the fact that z1 & z2 are both defined as being Double variables, so *why* does it do Integer division ?!?
Your answer makes perfect sense, but what is the point of being able to define an integer as Double, i.e. it WILL have decimal places, if the calculations to put a value into that variable totally ignore that fact ?!?!?
Gary Heath
21-Jul-12 8:17am
View
Ha Ha, oh yeah, can't see the wood for the trees sometimes !!! Thanks ... works just great now.
Gary Heath
20-Jul-12 15:38pm
View
Ok yes, I see now !!! I'm an experienced programmer, but all on IBM mainframes & have been mucking around with VBA, VB6 & now VB.net for about 4 or 5 years, I tried C# but gave it up, it's way too mental for an old boy like me !!! This is my first foray into SQL as well (though I've used DB2) and whilst the power and the adaptability of all this stuff is brilliant, it's also very difficult to grasp !!! Thanks for your help, both here and on previous questions, it's always appreciated ...
Gary Heath
20-Jul-12 15:37pm
View
Deleted
Ok yes, I see now !!! I'm an experienced programmer, but all on IBM mainframes & have been mucking around with VBA, VB6 & now VB.net for about 4 or 5 years, I tried C# but gave it up, it's way too mental for an old boy like me !!! This is my first foray into SQL as well (though I've used DB2) and whilst the power and the adaptability of all this stuff is brilliant, it's also very difficult to grasp !!! Thanks for your help, both here and on previous questions, it's always appreciated ...
Gary Heath
20-Jul-12 15:15pm
View
Bloody hell, excuse me if I give that article a miss for the time being, I'm still struggling with the basic concept of the language !!!
Gary Heath
20-Jul-12 14:54pm
View
Everything's wrapped in Using blocks now, thanks everybody ... and yes, lewax00, that makes a lot of sense !!!
Gary Heath
20-Jul-12 14:37pm
View
Yes, I just mentioned in the comment above that some of them are, I need to standardise them ... does this mean that if they are in Using blocks, I can omit the Close, or is best practice to close the Connection anyway ?
Gary Heath
20-Jul-12 14:36pm
View
Some of them are in Using blocks, some aren't, I need to go through and standardise them ... thanks
Gary Heath
20-Jul-12 11:12am
View
Thank you, I'm doing a bit of research into all this now. This is a learning exercise for me more than anything (though my user will still use it in his production environment) and I think that when I progress onto the main project I am supposed to do for him, then I will be using *real* SQL-Server, as it's for a multi-user web environment, so I'll definitely remember your comments when the time comes ...
Gary Heath
20-Jul-12 10:35am
View
I am using SQL-CE at the moment, as this is a very small 1-user application. Is this still capable of using "views and stored procedures" ?
Gary Heath
19-Jul-12 12:57pm
View
Yes, just found how to use ReadAllLines ... so much easier !!! Thanks again ...
Gary Heath
19-Jul-12 12:33pm
View
This does indeed resolve the problem, but whilst running the logic through Debug, I added a MessageBox to display each record as it is processed, and the first record it displays is Record 2, then when it finds the record that is longer than 16, which is the 4th record, it displays the 5th record, so something is dodgy about my code !!! I'm off to research how to use the File.ReadAllText & File.ReadAllLines that have been suggested ... thanks to everybody for their help.
Gary Heath
19-Jul-12 12:06pm
View
OK, that's what AlluvialDeposit said, but he didn't explain ... I was looking to do this via an Array in the first place, but I kept reading that this " list (of t)" method was better !!! So many different ways of doing things in this language !!! I'll get googling, thanks ...
Gary Heath
19-Jul-12 12:03pm
View
Can you please explain why (... and how !) ? It's taken me most of today just to fins out how to do this, I don't want to go changing it unless I have a good reason ...
Gary Heath
19-Jul-12 11:58am
View
But I don't know how to Close it, that's the question ... the way it is coded it is Dimmed as New, so the next time it processes this code, it already exists (or is open, or unusable, anyway !) ...
Gary Heath
19-Jul-12 11:55am
View
After I have checked every record, I then have to check the number of records, depending on a criteria that the user entered earlier, and if there is the correct number of records, then I want to write all of the stored records to a database Table.
Gary Heath
17-Jul-12 3:57am
View
It worked for me ...
Gary Heath
16-Jul-12 14:25pm
View
OK, got the Database back, thanks, but I had to actually delete it and add it again as a new Source ... VS2010 is so clever & so stupid at the same time !!!
Gary Heath
16-Jul-12 11:54am
View
OK, I understand what you are saying, conceptually, but am a bit confused by your wording, sorry Richard ! My Database is in a fixed location now and I am happy to access it from there until my testing has finished, but are you saying I should copy that to somewhere else and access it from there instead ? What about the Settings, should I have that set to "Do Not Copy" or "Copy if Newer" ?!? Some of this Visual Studio stuff is brilliant, but some of it is still so confusing !!!
Gary Heath
14-Jul-12 12:37pm
View
Thanks Björn, but it's actually C# I've given up on, I'm 53 and am a COBOL programmer, so the new techniques are difficult for me to grasp ... I can just about get my head around VB.net, but C# was killing me !!! I will revisit this, I am sure, when I get to some more complicated coding, but for now I am just rewriting the skeleton of my project in VB & taking it from there ... thanks again for your help.
Gary Heath
4-Apr-12 14:23pm
View
OK, I have vastly reduced the program as follows ...
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace MyWindowsVersion
{
public class WindowsVersion
{
public static string myNull(string myOSver)
{
String myStr = Environment.OSVersion.Version.ToString();
int myOSver1 = int.Parse(myStr.Substring(0,1));
int myOSver3 = int.Parse(myStr.Substring(0,3));
if (myOSver1 < 5)
myOSver = "Windows version prior to XP";
else if (myOSver3 < 5.1)
myOSver = "Windows version prior to XP";
else if (myOSver3 < 6.0)
myOSver = "Windows XP";
else if (myOSver3 < 6.1)
myOSver = "Windows Vista";
else if (myOSver3 == 6.1)
myOSver = "Windows 7";
else myOSver = "Windows Unknown Version";
return (myOSver);
}
}
}
As you can see, I still don't know how to write it so it isn't expecting a parameter, so I've assigned the string to be returned in the "Public Static" line, is that the way around this ?
However, I am having trouble picking it up, I'm obviously doing something wrong, but I've tried to do the same as the MSDN example but when I code ...
string myWinVer = MyWindowsVersion.WindowsVersion("x");
... I get an error "'MyWindowsVersion.WindowsVersion' is a 'type', which is not valid in the given context" ... Thanks for your help, BTW!!!
Gary Heath
4-Apr-12 14:04pm
View
That is the page I have used to base my code on, but as you can see, it is passing the DLL 2 variables and receiving a result back. I realise that in most cases that is the sort of thing you would want from a DLL, but as part of my learning, I'd like to know how to call a DLL without passing a variable, as in this case, extracting information about the OS.
I am just amending the program to make it more compact & remove the unnecessary concatenation, I realise that I try to do too much too quickly sometimes !!!
Gary Heath
4-Apr-12 13:30pm
View
Thanks Björn, I will certainly look at WMI, but this really is just an example, it is how to create and access DLL files that I am trying to get my head around ... but can't !!!
The code here that you refer to is because I was trying to return 2 variables, but found that I was unable to, so I thought I would just concatenate them & take them apart again back in the calling program, it's nothing important, just learning as I go along ...
Gary Heath
30-Mar-12 8:27am
View
Thanks for replying OriginalGriff ... I've read something about Clickonce doing this, but can't get it explained ... I've had a problem trying to resolve this for a week now and am just getting nowhere !!! To be honest, I don't give a damn where the Setup program is or where it runs from, but I use the Path to get at the other data & folders I am deploying on the new machine. These could be on a USB or CD with any drive letter assigned, or indeed on any drive under any Folder, if my user copies them before running them. So how do I know my Path to access these files & folders, which are NOT moved to the username directory ?!?
Gary Heath
17-Mar-12 4:14am
View
Thanks for your help here OriginalGriff, I'll try this out over the weekend & let you know how I get on on Monday ...
Gary Heath
15-Mar-12 13:22pm
View
So what do I have to do ? I don't understand, this works on my PC but the name of my PC (MEDESKTOP\GARY) isn't in the String at all, but it is the "Owner" of the Database in MS SQL Server Management Studio. In this case, as it just a test and my laptop is called MYLAPTOP\GARY, what do I actually have to do / change (and where) in order to get it to work on the Laptop ?!?
Gary Heath
14-Mar-12 19:17pm
View
Sorry about the delay, my baby swallowed one of my pills and we had to rush him to the hospital !!! They've kept him in overnight, but hopefully he'll be fine !!!
So what do I need to put in the String to get it to work ?!? Surely if you are supposed to write Projects that are to be deployed to other PCs there must be a way to do it ?!?
Gary Heath
14-Mar-12 13:16pm
View
Sorry, what do you mean by "...And it doesn't mean you got the string right!" ?
Gary Heath
14-Mar-12 13:16pm
View
Yes, thanks, I've seen these statements of yours in a number of places, but not until I had already tried installing my Project onto the laptop, so presumably the SQL Server Express option that is checked in my Prerequisites, should be unchecked for the future & SQL Server Express should be installed as a download on any PC that doesn't already have it on it, is that right ? Should I then uninstall anything on the laptop that relates to SQL Server & re-install from the MS Download ?
Gary Heath
14-Mar-12 13:11pm
View
As for those commands on the Laptop, when I entered OSQL followed by anything I got the message "Error, no user selected. Try with -U or -E command". When I typed OSQL /? it suggested I use Sqlcmd. When I did so I got messages saying "HResult 0x2, Level 16, State 1. Named Pipes Provider: Could not open a connection to SQL Server [2]" ... and a lot more !!!
With regard to SQLite or SQLCE, this small project is part of my learning curve as I am supposed to be re-writing a big Basic program soon that will use C# & SQL Server, so I need to learn as much about it as I can !!!
Gary Heath
14-Mar-12 13:02pm
View
OK, well my first understanding is that when you Publish a Project, it includes what will be needed inside it somewhere as defined by the Prerequisites & that is why SQL Server Express & .Net Framework are installed onto the new PC (my laptop in this case, which has a newly built WinXP on it with no "extras") if they are not already there (I have .Net Framework 3.5 SP1, Microsoft .Net Framework 4 (x86 & x64), SQL Server 2008 Express, Windows Installer 3.1 & Windows Installer 4.5 checked as Prerequisites), is that not the case ?
Gary Heath
14-Mar-12 12:32pm
View
Well, Dave, it's very basic, but you'd be right about me not understanding many things, not just the SQL Server security !!!
@"Data Source=.\SQLEXPRESS;Initial Catalog=KAELC_DB;Integrated Security=True"
Gary Heath
24-Feb-12 18:55pm
View
Still confused, I'm afraid Shameel. My database is created by SQL Server Data Centre edition, does that mean that a similar "level" of SQL Server will need to be installed on the recipient's PC ?
I suppose I am wondering if I should ignore this all-singing, all-dancing version of SQL Server & just use SQL Server Express ?!?!?
Gary Heath
17-Feb-12 12:36pm
View
Thank you, I knew it had to be something really stupid, but I've been sitting staring at it for so long, I just couldn't see anything wrong !!! Maybe I can relax & enjoy me evening now !!!
Gary Heath
13-Feb-12 17:14pm
View
It's not ideal, no, but needs must ...
Gary Heath
13-Feb-12 13:26pm
View
The problem I have, Christian, is that I am brand new to SQL Server, C# & Visual Studio, so am trying to figure things like that out !!! If your way is a better way of doing things then I'd like to get to that position, but I keep running into these stupid little problems that are just preventing me from doing anything !!!
Gary Heath
8-Feb-12 13:48pm
View
@Christian, Can you please explain (or point me at an example) of what you mean by "Put a top level crash handler in your app that closes the DB." ...
Gary Heath
8-Feb-12 9:51am
View
Sorry Christian, I don't understand ... what do you mean by "Access style database files" ? Everything I am doing here is created inside VS2010 & from C# & SQL Server sites I have found online. Where am I using "flat files" ?!?
Also, WhoLockMe is crashing, maybe it doesn't work in Vista :-( !!!
Gary Heath
31-Jan-12 13:35pm
View
My SQL Server version is Data Centre Edition.
If I try to create a database from within my VS2010 Project, it insists that it must be a .mdf file and these can only be created (the Microsoft Error Message states this and I have googled it too) if I have the Express version installed.
If I create it a DB outside of the project it is a .dbo file and is stored in my SQL folders on a different drive to my VS2010 folders and whilst this may not be a problem when I compile the project and transfer it to another PC (which is the ultimate plan) it is a problem now as VS2010 is not allowing me to do what my C# courses are telling me to do !!!
I have no real problem installing Express as well, but as usual, these MS instructions are nonsense !!!
Gary Heath
25-Jan-12 7:41am
View
I decided on the Tabs approach, yes, it's cleaner and nicer ... I don't understand the "Singleton" documentation that I have read, perhaps it should be "Simpleton" as far as I am concerned !!!
One thing I don't understand, though, and I'm not sure whether this is worthy of a whole new thread or not, I hope not, is that when processing the SQL, the Guide I am learning from tells me that I have to Open & Close the SQL Server Database, but I don't and it works fine ... is this just an advancement of VS2010 and I won't need to worry about that side of things at all ?!?!?
Gary Heath
24-Jan-12 9:24am
View
Thanks LanFanNinja, it's just something I was wondering about, I'm not definitely coding it yet, but wanted to know if there was an "easy" way ...
Gary Heath
20-Jan-12 12:41pm
View
My head is spinning !!! I think I am going to have to read these posts and your links quite a few times before I even begin to comprehend !!!
Gary Heath
20-Jan-12 10:47am
View
Yes, to a certain degree, you are right, my mind (which isn't surprising after working that way for over 30 years !) still tends to think "here's some data, how do I deal with it", rather than "here is everything you could ever want, what do you want to do" !!! It isn't easy getting my head round it, especially the naming conventions, hooks, model classes, modal forms, etc.
I am trying to write a program for a friend of mine who runs a PBM game to speed things up for him. In the long run it is my job to rewrite the game in C# using .net & SQL Server, and as part of my learning curve I am writing this program (creating this Project !).
I couldn't see an option for using Tabs, so I decided on a MenuStrip across the top of the Form that splits his options, rather than create an interactive Form which changes it's layout depending on his choices within ComboBox dropdowns, I thought that would be less complicated and of course it allows me to design the Forms within VS2010 rather than code them.
Option 1 is to maintain the database, add new leagues, modify names, delete old leagues, then within that, to rename, add and delete Teams within each league. Option 2 is to generate a Cup competition from that SQL data & create a .Txt file for him to use in the processing that he does on his Atari Emulator (hence the need for the update / rewrite that I am looking at). Option 3 (not needed yet) will be to automatically read and process the results from the processed turn, some 2 or 3 weeks later.
As you see, there are three very distinct processes that make up the whole thing, and I do want to encompass them within the one Project to make things easier for him to process as much as anything else, as he's even more of a dinosaur than I am !!!
Is that enough detail :-) ?!?!?
Show More