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
O

OldWarhorse

@OldWarhorse
About
Posts
35
Topics
0
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Design Methods ? [moved]
    O OldWarhorse

    My god, what a thread... :omg: Best laugh I've had in months. :laugh:

    Design and Architecture csharp design question

  • ok what are the rules
    O OldWarhorse

    "Eppur si muove" - ? :)

    The Lounge tutorial

  • connectivity in vb6
    O OldWarhorse

    You just asked for about 100 pages worth of information in any one of 2 or 3 HUNDRED books published in the last ten years, and ALL of which is available on MSDN... :omg: :wtf:

    Visual Basic tutorial question

  • How to improve Software Performance when there is huge Data in SQL Server Using VB
    O OldWarhorse

    Sunil, You just answered your own question. (Guy goes to the doctor and says "Doctor, it hurts when I do this." Doctor says, (all together now),) "DON'T DO THAT!" The problem is not on your database side, it is on the client side, in your code. Yes, using a for loop and adding one record at a time is the SLOWEST way to fill the grid. Use databinding if at all possible. But first of all, you haven't provided enough information to really help here. Can't fix what ya can't see. Tell which version of VB, which datagrid component you are using, which type of backing store you are filling the grid from (ADO recordset, .Net datatable, datareader, whatever), and show the sql. :)

    Visual Basic database sql-server sysadmin performance help

  • Printing problems in VB
    O OldWarhorse

    That's what I was afraid of... Been a long time since I messed with that. I wish I had a good example for you, but there should be a bunch of em out there (good ol' Google).

    Visual Basic graphics question

  • Hard drive Info
    O OldWarhorse

    You're welcome! :-D (I gotta go do some nasty work for a while now. Fighting an 8-headed datagrid monster. Catch ya later. Happy coding.)

    Visual Basic csharp help question

  • Function; changing ByRef to ByVal
    O OldWarhorse

    Excellent. Good work! :-D

    Visual Basic question

  • Hard drive Info
    O OldWarhorse

    Try something like this:

        Dim dr As New System.IO.DriveInfo("C")
        Dim sizeInBytes As Long
        Dim sizeInGB As Single
    
        sizeInBytes = dr.TotalSize
        sizeInGB = sizeInBytes / 1000000000
        TextBox1.Text = String.Format("Total Drive Size in Bytes:  {0}", sizeInBytes.ToString("#,###,###,###,###"))
        TextBox2.Text = String.Format("Total Drive Size in GB:  {0}", sizeInGB.ToString("###,###,###,###.00"))
    

    You can play around with the verbage, divisor value, and formatting as you prefer.

    Visual Basic csharp help question

  • Printing problems in VB
    O OldWarhorse

    Looks like the graphic might be overlaying the print buffer. I would try the simplest approach first, and put an EndDoc after the listbox loop and see if that will flush the buffer without advancing the page. Failing that, you might have to set the text and graphics onto a Form or Picture box first, and then call PrintForm.

    Visual Basic graphics question

  • Hard drive Info
    O OldWarhorse

    :laugh: - You crack me up, Dude. Hey, the only dumb question is the one you should have asked and didn't, right? :)

    Visual Basic csharp help question

  • Hard drive Info
    O OldWarhorse

    System.IO.DriveInfo Boy, you're being a P.I.A. today. You're gonna owe me a cut of that app. :laugh:

    Visual Basic csharp help question

  • Function; changing ByRef to ByVal
    O OldWarhorse

    The reason she wants you to change it to ByVal is to see if you understand the difference between passing arguments by value and passing them by reference. Obviously, you don't yet. You just skimmed over that section in the book, and you can't do that. This key point is fundamental to just about all programming languages, not just VisualBasic. We could just show you how to change it and make it "give the right answer", but that would doing you and the industry a grave disservice. So go back to your book, find that section, and re-read it. Several times if necessary. This may also help. Visual Basic Language Concepts Differences Between Passing an Argument By Value and By Reference http://msdn2.microsoft.com/en-us/library/eek064h4(VS.80).aspx[^] Hint 1: ByRef gives your procedure code a direct view back to the original variable. ByVal gives your procedure code a COPY of, and an indirect view of, the VALUE of the original variable. Hint 2: Why code a Function if you are just going to call it as a Sub and not use the return value from it? ;)

    Visual Basic question

  • create array on runtime
    O OldWarhorse

    OK. Here's what you need to do. Or what I would do.* I would use a HashTable of ArrayLists. Quick, easy, efficient, fairly robust, good cost/benefit ratio. Downside: Not strongly-typed. You don't want to use raw arrays because you would either have to oversize them to begin with (how many? 1000? 5000? Wasteful and error prone), OR you would have to keep ReDim'ing them (bad performance). You could use ArrayList to get around that problem, but you still have no good keyed access to your entries. That's where the HashTable comes in. The HashTable (or Dictionary<..>, depending on your version and requirements) simply stores entries of Key and Value pairs. In this case your Key would be the Call Center number, and it's Value would be an ArrayList. The ArrayList would store the Agent objects. Every time you hit a new call center, you create a new hashtable entry using the call center number as the key, and a new arraylist with the Agent on that call as it's initial value, which effectively allows you to "create a new variable at runtime with a particular name". (Or, instead of storing the agent object in the arraylist slot, you could create a hashtable of Agents, and just store a reference to that agent's entry in the arraylist slot.) How do you know it's a new call center? By using the ContainsKey function of the hashtable, or by simply trying to access the item with that key. If it doesn't exist, you get back Null. If it does exist, you add the agent (or a reference to the agent) to its arraylist. Simple. If you're not familiar with hashtables, take an hour or so and read up on them. Set one up and play with it. Don't be afraid of them. Very powerful tool. *Now. All that having been said, this is NOT the only way or best way to engineer this, it's just a quick-and-dirty as far as I look at it. Keep in mind what Dave K. said. What you're really doing here is modeling and managing entity relationships. Call Centers, Agents, Calls, Extensions... Which means you might be better served to use a strongly-typed DataSet, with Tables and DataRelations to begin with. You are probably going to need to do that eventually anyway. Hope this helps. Good luck.

    Visual Basic csharp data-structures question

  • Make a trial [modified]
    O OldWarhorse

    Here are some ideas... How to create a Trial Version http://groups.google.com/group/microsoft.public.fox.programmer.exchange/browse_thread/thread/ab06c1938cce6361/8b8332b489c0f434%238b8332b489c0f434[^] -- modified at 22:33 Saturday 4th November, 2006 Here's a commercial crack-protector that says it will create a trial version, and a list of similar products... (I don't know anything about them...) http://www.soft32.com/download_7549.html[^]

    Visual Basic question help

  • Having a form name , how to show this form ?
    O OldWarhorse

    This is not a trivial task. If all you have is the simple form name as a string, then you need to use some sort of Reflection to create an instance of that type, AND you have to use the full name of the type, which is "Namespace.Type". Here's one approach: "Loading Classes on the Fly" http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnadvnet/html/vbnet10082002.asp Here's a similar way, that does not use a configuration file. I just used the assembly name, which should work, unless you or another developer has placed the forms in a different namespace. Either way, you have to know the namespace of the type. If it happens to be the same as the assembly, which usually it will be, then you're in good shape. If not, you just have to know the namespace, and prepend it to the form name. (And don't forget to use proper exception handling. Do as I say, not as I do.)

    Imports System.Reflection
    Module Module1
    Friend Function GetFormUsingGetType(ByVal formName As String) As Form
    Dim myAssembly As [Assembly] = [Assembly].GetExecutingAssembly
    Dim myForm As Form
    Dim myFormName As String
    Dim myType As Type
    Dim myAssemblyNameObj As AssemblyName = myAssembly.GetExecutingAssembly.GetName
    Dim myAssemblyName As String

    myAssemblyName = myAssemblyNameObj.Name
    myType = myAssembly.GetType(myAssemblyName & "." & formName, True, True)
    myFormName = myType.FullName
    myForm = CType(myAssembly.CreateInstance(myFormName), Form)
    Return myForm
    

    End Function

    Friend Function GetFormUsingActivator(ByVal formName As String) As Form
    Dim myForm As Form
    Dim myFormName As String
    Dim myAssemblyNameObj As AssemblyName = [Assembly].GetExecutingAssembly.GetName
    Dim myAssemblyName As String
    Dim obj As System.Runtime.Remoting.ObjectHandle

    myAssemblyName = myAssemblyNameObj.Name
    myFormName = myAssemblyName & "." & formName
    obj = Activator.CreateInstance(myAssemblyName, myFormName)
    myForm = CType(obj.Unwrap, Form)
    Return myForm
    

    End Function
    End Module

    Visual Basic tutorial question

  • Recent files in combobox
    O OldWarhorse

    Here's some VB6 code you might be able to use: http://www.freevbcode.com/ShowCode.asp?ID=6529[^]

    Visual Basic regex

  • WeifenLuo forms
    O OldWarhorse

    First of all, look here: http://216.239.51.104/search?q=cache:sa17H0oSzSkJ:www.codeproject.com/cs/miscctrl/DockManager.asp+WeifenLuo+forms&hl=en&gl=us&ct=clnk&cd=9[^] Then here: IMPORTANT NOTICE: DockManager control is now obsolete and not supported. Please download the upgrade, DockPanel Suite, from sourceforge here. http://sourceforge.net/projects/dockpanelsuite[^] Then, I think you would get a better response and more info here: http://sourceforge.net/forum/forum.php?forum_id=402316[^]

    Visual Basic question

  • create array on runtime
    O OldWarhorse

    Google this: "jagged arrays vb .net"

    Visual Basic csharp data-structures question

  • How to swap values in database with the help of combobox
    O OldWarhorse

    See your first post.

    Visual Basic database help tutorial question

  • Swaping
    O OldWarhorse

    Safecom wrote:

    I m using combobox to get values from database.

    No, you are using a DataProvider to get values from the database. Those values are provided to you in a stream. You can put those values into various containers, eg. a DataTable, an Array of List Objects, etc. which can then be fed or bound to your control. They should be encapsulated in a list of business objects, (preferably using a list type that implements IList - ArrayList is good) which is then manipulated (sorted according to your business rules, which may change momentarily by user gestures such as clicking radio buttons, checkboxes, etc.) and then presented to the user in the ComboBox. You may need to add a suitable sort key to your business object to help with the re-sorting/swapping. You can do all that off the DropDown event if necessary, but you will take a performance hit. It would be better to evaluate your conditions beforehand if possible, using other control events, and re-sort the list (and rebind the list to the control) before the user drops it down. SelectedIndexChange is too late. The user has already seen the list.

    Visual Basic database
  • Login

  • Don't have an account? Register

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