Jump to content
Xtreme .Net Talk

MarkD

Avatar/Signature
  • Posts

    31
  • Joined

  • Last visited

Everything posted by MarkD

  1. OK so I managed to save an object in a collection with a key: myCollection.Add(myObject, intPK) How do I get it back using the Key rather than the Item number? :confused:
  2. Cool! that did it. Thanks to both of you for your help :) Mark
  3. Thanks Afraits, Yes, it is an autonumber field. Do you have an example line of code I would use to do this? (I tried: iCurrentRow = drRow.Item("IncidentID") after the .Add(drRow) above thinking by that time the key would have been assigned in the datatable but it comes back NULL)
  4. Happy Memorial Day! :) I have an ADO.Net datatable coding question; this may be elementary, but I'm stumped... Is there an easy way (or what's the best way) to retrieve the key of a record you just added to a table? I have the following code... can someone help me fill in the ??? ' add a new row to the table Dim drRow As DataRow drRow = selectedDataTbl.NewRow() selectedDataTbl.Rows.Add(drRow) ' save its ID iCurrentRowID = selectedDataTbl.??? Thanks, Mark
  5. I got it! For future interest/reference... On further fooling around with it I discovered that I simply could not use another function within the Ctype as the system.whatevertype argument so, it's not very eloquent, but I had to do the following: Select Case TypeName(objTo) Case "Date" objTo = CType(objFrom, System.DateTime) Case "String" objTo = CType(objFrom, System.String) End Select glad I only have to deal with strings to dates or dates to strings on this one :)
  6. I'm trying to do the following line of code to copy (in this case) a Date to a String (but I don't normally know what the objects are in advance): objTo = CType(objFrom, typename(objTo)) When I do "typename" is not resolved; I get a "not defined" msg when I hover the cursor over it. I AM using "Imports microsoft.VisualBasic.Information" as the first line in my module to call in the MS namespace. But that doesn't seem to resolve either, as when I type it in intellisense (or whatever it's called) wants to fill in the .VisualBasic and the .Information as I type in the dots. But when I leave the line the "m" in Microsoft. doesn't capitalize. what gives? Shouldn't importing be all I need to resolve things? and why no recognition on Imports stmt? Can I use TypeName function in this way for casting
  7. WAY COOL! Everything looks good so far. All I need to do is identify what my smtpserver is and emails will fly! :) Thank you for your help Sam :) Mark
  8. Thanks Sam. I plugged it into my program and the Import for System.Web.Mail doesn't resolve. I get: 'Namespace or type "Mail' for the Imports 'System.Web.Mail' cannot be found." I also get message for one of the types: "Type 'MailFormat' is not defined." but probably due to the above. Do I need to reference the 'System.Web.Mail' namespace other than the Include to get it into my program? How to do? Mark
  9. Is there a relatively simple way to sent an email from VB.Net code? I just need a light-duty way to send a simple e-mail (no attachments) using the default mail handler on a PC. (I've seen a few relatively heavy-duty (complex) methods in my research but don't want or need the complexity). Thanks :) Mark
  10. way cool! :) Way cool ner :) This is the deal... the key combinations didn't work for me at first. Then, thinking it may be my keyboard mapping, which I'd set to VB6, I changed back to "default mapping". And, voila! The keys now perform as you specified in your note. I should have sent this thread out when I started w/ .net 2 yrs ago (actually I think I did, but got no response). Oh well, better late than never. I'm thrilled :) (where do they write this stuff down? :)) ) Thanks again. Mark
  11. In writing VBA code in Access or Excel I can right-click on my code and drop-down a list that includes options to: "Go To Definition", or go to: "Last Position". I find "Last Position" to be as helpful/necessary as the "Go To Definition" option. However, when developing VB.Net code in the Studio.Net IDE, "Last Position" is not in the similar list (It's annoying and time consuming to the extreme to have to go to solution explorer, try to remember where I was, and navigate back, after I've gone to definition for a quick reference). Am I missing something? Is there some item I can change in my .Net configuration to put "Last Position" option in the .Net drop-down list? If so, how do I set it up? :) If not, why did MS pull out such a valuable option when implimenting studio.net? :( Thanks, Mark
  12. Simon, I have them in the form of two Word docs and am not sure how to send via the forum. Do you mind if I just e-mail them to you off-line? If not, your e-mail address? Mark
  13. Don't know good books, but I can send you a snippet that shows how to do a datareader or dataset using an SQL Server database's stored procedure that takes parameters. Would that help?
  14. Hello: I open a stored procedure in an SQLServer database and use it to populate a combo box drop-down list on my form via an ADO DataReader in VB.Net. My problem is, I get an error doing the .Add when the column I am reading is NULL. I wrapped it in logic (an IF stmt) to try to process only non-NULL data, but get the same error on the IF statement as well. My (probably elementary) question is: is there another way to reference the column I want to check for NULL that will not give the error? My code snippet and the error message follow. I've already executed the open for the datareader at this point. I'm just showing my iteration through the datareader to populate the combo box: Do Until drDR.Read = False ' load only non-null entries If Not IsDBNull(drDR.GetString(FieldIdx)) Then cBOX.Items.Add(drDR(FieldIdx)) cBOX.Items.IndexOf(drDR.GetString(FieldIdx)) End If Loop Error: Data is Null. This method or property cannot be called on null values. Thanks, Mark
  15. Does anyone know how to add a control to a form's title bar? I've disabled the Control Box property (set to false) on a form becasue I don't want to allow the user to X out of the form. However, I do want to give them the option of minimizing the form and would like to put just a single 'minimize' button control back on the title bar to do so. When I use the control wizard to drag one there I'm stopped short just below the title bar on the form. Anyone know any tricks to place the control onto the title bar? Thanks, Mark
  16. THAT's way-Cool :cool: I can't wait to try it out. (I need to do the same kind of thing on 4-5 forms in this project - could save me lots of time/ future headaches). Thanks, Mark
  17. Don't think this is dumb, but... I have a form that has multiple repetitive combo boxes all the same that I want to populate with the same Access table when it loads. Presently, I repeat the same code stream to do so, each time with a slight variation, because I need to reference the combo box by name. The snippet below shows the code for only two controls, but I actually go on to fill 8 combo boxes. I'd like to code a class module that I can use to do this for each control instead of repeating the code in line 8 times; except, I'm not sure how to pass the control name I'm working with to the class. Any ideas, or examples, or the name of a good book that might address using classes with repetitive controls on forms? Thanks, Mark In the following code I already have a connection and dataset set up to my Access database table. I loop through the table and build my combo box list with each record in the table. blnISDone is set to true by error handling when I get to the end of my table: Private Sub CreateAgencyLists() On Error GoTo _Err Dim blnISDone As Boolean = False Dim idxRow As Integer = 0 ' populate 1st control's list Do Until blnISDone = True cbox1.Items.Add(dsName.Tables("Agency").Rows(idxRow).Item("Name")) idxRow = idxRow + 1 Loop ' populate next control's list blnISDone = False idxRow = 0 Do Until blnISDone = True cbox2.Items.Add(dsName.Tables("Agency").Rows(idxRow).Item("Name")) idxRow = idxRow + 1 Loop . . six more iterations of the code for cbox3, cbox4 ...(yuch!) . * end of example *
  18. WOW! You're a genius!! works great! Thanks, mark
  19. Does anyone have a code snippet I can use to do an API Call to retrieve the current Userid in VB.net? (who is currently logged onto Windows on this PC?) Thanks, Mark
  20. There's probably an easy way to avoid this but it evades me. When I hit the Tab key in succession I want my cursor to move to text boxes back and forth between frames (my text boxes are placed within two separate frames on the form). My problem is twofold: 1-First, cursor movement seems to have to exhaust all tabstops in one frame before the cursor will jump to the next frame regardless of the Tabindex I have set (I have tabindex sequence set from text boxes in one frame to the other frame and back again). 2-Second, my cursor movement goes to labels as well as text boxes... I don't want to stop at labels, but labels don't show a Tabstop property I can set to false. Any suggestions?
  21. thanks! :)
  22. A little basic (pun intended :)) ) instruction needed here. How do I set a checkbox control to true? (checked). CBox.checked = true seems like it should work but, no luck. Thanks, Mark
  23. Nice! Thank you Andy.
  24. Hello: I want to add a few buttons onto my TabControl form (such as: Prevoius, Next) so user can have an option for going between TabPages other than clicking on the tabs. Does anyone have a code snippet (or know where I can find one) that demonstrates how to close the current tab page and open another tab page? The info seems to be evading me in the Helps and documentation on TabControl and TabPages. Thanks! Mark
  25. You're Great Jon! Thanks, works like a charm. Mark
×
×
  • Create New...