15,899,679 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 Darrell de Wet (Top 47 by date)
Darrell de Wet
28-Jul-20 11:07am
View
Makes sense. Thanks for the quick response.
Darrell de Wet
3-May-18 4:08am
View
Got it. Thanks a lot Richard.
Darrell de Wet
8-Mar-17 6:45am
View
Thanks, Richard, for the quick response. I will take a good hard look that these.
Darrell de Wet
8-Mar-17 6:42am
View
Now that's a good idea. I did not know that I could use .Replace in my Select statement.
Thank you very much.
Darrell de Wet
12-Sep-16 4:28am
View
Thank you.
You have helped me a few times before and your advice is indeed appreciated.
Darrell de Wet
27-Oct-15 9:57am
View
Phil.o responded to my request within about 12 minutes, he provide the right answer the first time, was perfectly polite, and certainly never made me feel like a fool. Deserved all the accolades that he got, I think.
Darrell de Wet
27-Oct-15 5:29am
View
You're a star. Thanks. Works well.
Darrell de Wet
31-Oct-14 13:09pm
View
Your time and effort is much appreciated. Thanks for the answer.
I have, by the way learned the basics (and continue to learn more daily) - have used RETURN in many Private Functions, but as I said in the original question I have never written a Class Library and in this instance RETURN never occurred to me.
Darrell de Wet
31-Oct-14 7:06am
View
Hi Richard. Thanks for the response.
I'm not the most experienced programmer and it often shows in the poor way that I ask questions.
If I debug and hit F11 to step thru each line of code I can follow the thread the program follows. If the program says eq, OpenDBConnection("Commercial") and OpenDBConnection is the Class Library and Commercial is the database I wish to open then debug will lead me into the code in the Class Library.
One of the first things the the Class library must check is if the database exists.
eg. If NotExists ...... path & "Commercial" & ".accdb" then
END
endif
in other words 'prematurely terminate the class library' and return to the next line of code in the form. rather than go to the code within the class that actually establishes the connection string.
Hope i'm making a little more sense.
Thanks
Darrell
Darrell de Wet
24-Oct-14 8:03am
View
My HTML skills are almost non existent but I see what you are saying.
I am going to give it a try.
thanks very much for your time and effort
Darrell de Wet
24-Oct-14 7:33am
View
Again you came through. Thanks a million - font never even crossed my mind. Works perfectly. And to think I have sweated for many hours over this.
Darrell de Wet
24-Oct-14 7:03am
View
Hi. It is currently HTML. But problem still exists if I write to NotePad.
Darrell de Wet
24-Oct-14 6:15am
View
As always, your assistance is much appreciated.
Darrell de Wet
20-Jul-14 7:46am
View
Brilliant - thanks very much.
Darrell de Wet
18-Jul-14 1:53am
View
A very good article - thanks for the pointer.
Darrell de Wet
17-Jul-14 10:14am
View
Hi Nilesh. All the columns in VEHICLES
Darrell de Wet
15-Jul-14 8:13am
View
Wonderful - the label was in a GroupBox. I changed Me. to groupbox name and it worked like a dream.
I thank you greatly for taking the time to teach me something !!
Darrell de Wet
15-Jul-14 7:54am
View
Hi Daniele. Thanks for your response and suggestions which look good.
The Tag property is probably what I am going to go with but before that :
Your code change almost works, just that when I try to execute the
InitCtrl.Text = "Primary Project" statement
I get 'Object reference not set to an instance of an object'
Any suggestions on how to fix that.
Your assistance is much appreciated.
Darrell de Wet
2-May-14 1:54am
View
Thank you very much.
Darrell de Wet
10-Mar-14 8:16am
View
Ah, you are a star - thanks very much.
Darrell de Wet
9-Jan-14 8:40am
View
Perhaps I was not clear in my question so I have updated it.
Would you be kind enough to check it again.
Thanks.
Darrell de Wet
9-Jan-14 8:08am
View
Thanks for the reply
The problem is that focuseditem.index returns the value 0.
I need to determine if the 5th row of the listview is selected how I can get something to return the value 5.
Darrell de Wet
9-Jan-14 8:07am
View
I have already looked at both of those sites.
The problem is that focuseditem.index returns the value 0.
I need to determine if the 5th row of the listview is selected how I can get something to return the value 5.
Darrell de Wet
6-Jan-14 9:21am
View
Thank you.
Darrell de Wet
5-Dec-13 2:36am
View
Hi Fredrik - thanks for your response.
I hope that I am not using any unsafe code - what would unsafe code be?
I am relatively new to .Net so I can do with all the assistance I can get
Darrell de Wet
5-Dec-13 2:34am
View
Morning cigwork.
Thanks for your assistance.
Part 2 of your reply : I tried as you suggested and there appears to be no problem seeing the server directory.
I have also included the ofd.dispose() statement and that seems to have changed tings a bit.
The form contains a ListView where all the suppliers are listed. If the user clicks on a supplier, the suppliers details are then placed in a group of controls (textboxes, checkedboxes etc) so that the user can change as required.
The 'Certificate Path' button is included with these.
If the user clicks on the listview and then on the button a blank dialog box is opened with only file name, files of Type combo boxes and Open, Cancel buttons visible - the rest completely blank.
If the first thing the user does is click on the Certificate button then the dialog boxes opens perfectly and thereafter they can click on the listview and Certificate button as often a required and it works perfectly.
Fredrik Bornader asked if I was using any unsafe code - I certainly hope not. Do you have any idea what might constitute unsafe code?
Any thoughts on this? Your assistance is truly appreciated.
Darrell de Wet
4-Dec-13 7:24am
View
Yes. I just changed it to xxx for this post. xxx = File server name.
Darrell de Wet
4-Sep-13 1:41am
View
That's brilliant, thanks very much. I tried your alternative suggestion and it worked like a dream. Thank you for your effort.
Darrell de Wet
8-Aug-13 7:05am
View
Hi there
Still get Syntax error - this time on the word Decimal. Am using MS Access 2007
Darrell de Wet
8-Aug-13 5:52am
View
Hi
Thanks for the reply.
That produces a Syntax error as well (on the open bracket)
Darrell de Wet
1-Jul-13 4:41am
View
Ok, I understand. Thank you very much for the explanation, I appreciate your time.
Darrell de Wet
24-Jun-13 3:11am
View
Aw man, so simple.
Thanks very much for the help - works perfectly.
Darrell de Wet
30-May-13 2:28am
View
Brilliant. Thanks a lot. You taught me something that has been bothering me for a while.
Darrell de Wet
22-May-13 5:54am
View
Interesting, I'll give it a shot. I still have much to learn.
Thanks for the advise.
Darrell de Wet
14-May-13 7:07am
View
Ahh great - easy if you know how.
On which form do I add Form.TopMost = True (parent or called form)?
And thanks for the FormClosing advice - never thought of that.
Your assistance much appreciated.
Darrell de Wet
11-Mar-13 6:57am
View
Of course - I read your article and it makes perfectly good sense.
Sometimes I cannot quite see further than my nose.
Thanks for the advice
Darrell de Wet
21-Feb-13 6:37am
View
Thanks again. I used Raimis9 advise and it worked beautifully.
You have both taught me something - appreciate it !!
Darrell de Wet
21-Feb-13 6:24am
View
Works like a dream - thank you.
Darrell de Wet
21-Feb-13 5:53am
View
Ahh shoot, Ive tried everyting except that.
Thanks for your quick response and sorry if I wasted your time but thats how beginners learn I guess.
As a quick test I included a line :
msgbox(sender.ToString)
to see which sender and i got the result :
System.Windows.Forms.ComboBox.Items.Count:2
Your solution is a step in the right direction but with 15 odd Comboxes it still does not tell me which one the sender is.
Can you assists a little further?
I appreciate the help.
Darrell de Wet
10-Feb-13 4:20am
View
Oops, I lied to you - it's not Dim'd as double. The variable that is dim'd as doubl is written to a ListView - then taken from the list view (see code below)
A little history on the code :
This is a Putchase Order program - line items are captured and placed in a ListView.
When the line items are complete the user saves the data and requests an authorisation (hence the email)
Private Sub SendAuthEMail()
Dim SmtpServer As New SmtpClient()
Dim mail As New MailMessage()
Dim ds1 As New DataSet
Dim theVat As String
Dim theTotal As String
Dim theItem As String
Me.lsv_Line_Items.Focus()
For x = 0 To lsv_Line_Items.Items.Count - 1
Me.lsv_Line_Items.Items(x).Selected = True
Me.lsv_Line_Items.Items(x).Focused = True
theItem = theItem & " " & lsv_Line_Items.SelectedItems(0).SubItems(2).Text & Chr(9) 'Qty
theItem = theItem & " " & lsv_Line_Items.SelectedItems(0).SubItems(3).Text & Chr(9) 'Unit
theItem = theItem & " " & lsv_Line_Items.SelectedItems(0).SubItems(1).Text & Chr(9) 'Descr
theItem = theItem & " " & lsv_Line_Items.SelectedItems(0).SubItems(6).Text & vbCrLf 'Gross Price
Next x
mail = New MailMessage()
mail.Subject = "Purchase Order authorisation request - " & lbl_Order_Number.Text
mail.Body = "Purchase Order No : " & lbl_Order_Number.Text & vbCrLf & _
" " & " " & vbCrLf & _
"Supplier : " & cbo_Supplier.Text & vbCrLf & _
" " & " " & vbCrLf & _
"Currency : " & cbo_Currency.Text & vbCrLf & _
"Order Value - Tot : " & lbl_Sub_Total.Text & vbCrLf & _
" Vat : " & theVat & vbCrLf & _
" Grand Total : " & theTotal & vbCrLf & _
" " & " " & vbCrLf & _
"" & theItem & vbCrLf & _
" " & " " & vbCrLf & _
" System Generated E-Mail (Do not Reply)"
cn.ConnectionString = "Provider=" & cp & " Data Source=" & GlobalVariables.DBPath & GlobalVariables.DBName & ";Persist Security Info=False;"
cn.Open() 'Open the connection
Ssql = "SELECT MR_Name_Surname FROM Mail_Recipient WHERE MR_Mail_Rec = 'Purchase Order'"
da = New OleDb.OleDbDataAdapter(Ssql, cn)
da.Fill(ds, "MRecip")
cn.Close()
If ds.Tables("MRecip").Rows.Count = 0 Then
MsgBox("No Purchase Order Authorisers have been registered - Mail cannot be sent")
Exit Sub
End If
For x = 0 To ds.Tables("MRecip").Rows.Count - 1
Ssql = "SELECT HR_EMail FROM HR WHERE HR_Name_Surname = '" & ds.Tables("MRecip").Rows(x).Item(0).ToString() & "'"
da = New OleDb.OleDbDataAdapter(Ssql, cn)
da.Fill(ds1, "MRecipM")
mail.To.Add(ds1.Tables("MRecipM").Rows(0).Item(0).ToString()) 'Add mail recipient
ds1.Clear()
Next x
ds.Clear()
SmtpServer.Credentials = New Net.NetworkCredential(email address", "password") ' Senders email address and password
SmtpServer.Port = 25 'The port
SmtpServer.Host = "hostname" 'Host
mail.From = New MailAddress("email address") 'Same email address as used above (*Credentials)
SmtpServer.Send(mail)
End Sub 'SendAuthEMail()
Darrell de Wet
10-Feb-13 3:16am
View
Hi Abhinev
Thanks for your quick response.
Unfortunately the \r or\r\n has not worked.
My instinct, which given my level of experience with .net is not great, says that using Regex will not help because I cannot identify the character that i am trying to replace.
Any suggestions ?
Darrell de Wet
5-Feb-13 9:09am
View
Hi Richard
Essentially it is. The other question seemed a little .net orientated and i figured that the problem coud be a purely Access problem so i posted again.
I hope that it has not irked anyone.
Either way I have received some good advice on both.
Darrell de Wet
5-Feb-13 8:49am
View
You are a star !!! Works !!!
Exactly as you said - no change required when I read it back.
Thank you sooo much
Darrell de Wet
5-Feb-13 8:44am
View
Ahh good point about the 3 M's - i did not notice that. I'll give it a try and let you know. I can just convert from MMM to MM when i read it back. This problem is driving me nuts.
Thanks for your support.
Darrell de Wet
5-Feb-13 8:08am
View
Hi Chill
Thanks for the quick response. I tried your suggestion and got the same result so I swapped the dd and MM around ie("MM/dd/yyyy") and the database now contains the date as i need it.
This makes no sense to me as my (Win 7) Regiona and Language settings are dd/mm/yyyy for short date.
I also tried to run my original SQL statement in Ms Access and had the same original problem. When i tried with your chganges (and swapped the dd & mm) around it achieved the desired result.
the database contains the date as i need it but it thinks it in in format MM/DD/YYYY and i am concerned that it is going to come back and bite me sometime.
Any thoughts?
Darrell de Wet
5-Feb-13 6:30am
View
Thanks Marcus. It has taken a while for me to get back to this question because of other commitments but i appreciate you guidance. It appears to be just what i need
Darrell de Wet
28-Nov-12 1:07am
View
Good Morning
Thanks for the responses. OK, I'm not too good at this (I am 2 weeks old in the .net world, I only know VBA and this is my first post ever) - i i'll start over.
I am writing with Visual Studio 2010 Professional using only Visual Basic (Windows Applications). I also have an Access 2007 Database (.accdb)
After placing combobox on the form, if you then view the combobox properties there is a DataSource property. If you click on 'Add Add Project dataSource' a wizard allows you to select the database (Calleed CommercialDb.accdb) and it sets up a connection and an SQl statement so that at runtime the combobox is populated with the field from the table that was selected during the 'wizard run' mentioned earlier.
Wizard then places 3 controls on the form (not directly on it but underneath in a grey shaed area below the form) called CommercialDBDataset, AuthoritiesBindingSource and AuthoritiesTableAdapter (Authorities being the name of the table within CommercialDB).
Now my application has a parameter file which contains the path to the Database. this is use to build trhe connection string for other connections to the database. I have a test Database and a production database (the parameter file specifies which one the application should use). The path to the database in the controls that were created for the combobox Datasource are 'hard coded' so i got smart amd tried to change them - this resulted in the 101 errors (all reported from a ton of genetrated code that i could never possibly post on this site and it would largely be a waste of time because it is generated code.
what i was hoping to do was delete the controls created by the datasouce wizard, thereby delete the genetated code, and start again with the wizard.
i am afraid to simply delete these things because i could end up with no program at all whereas i can still see my own code at the moment (although i cannot run the program)
my question then is, how can i, if at all possible delete these controls (which i previously refered to as 'artifacts'
your advive would be much appreciated because this is a fairly large program and i cant afford to loose it.
thanks again
Show More