vb.net vs. vc++?

  • (2 Pages)
  • +
  • 1
  • 2

20 Replies - 660 Views - Last Post: 15 January 2013 - 11:54 AM Rate Topic: -----

#1 rusoaica  Icon User is offline

  • D.I.C Head

Reputation: 23
  • View blog
  • Posts: 184
  • Joined: 10-March 12

vb.net vs. vc++?

Posted 15 January 2013 - 05:47 AM

Hello! I am pretty comfortable with vb.net and i can say i can find my way around building a program in it. I mostly design programs containing custom controls (buttons, labels, pictureboxes, etc), looking like this:

Posted Image.


However, the program become more and more complex, and now, in the load event of any form, i have hundreds of statements, which makes them take more than 10 seconds to display. I want to overstep this difficulty and i found out that vb.net can sometimes be pretty slow, because it is "managed" code (?). Some people suggested me i should stick with native c++, which should build programs that execute much faster, are more robust and offer a greater control over the programming. I also always wanted to learn c++, so this sounds appealing to me :) However, being almost a noob in c++, i have few questions: using native code, is the program still dependent on the .net framework? I do not want this! Also, can i make custom controls using native code? Is native code meaning that my programs would be cross-platform ( i would love to be able to achieve this, also)? Nonetheless, i pretty much used myself to program in visual studio. Can i write programs in VC++ containing those custom controls in such way that they won't be .net dependent? If not, is there a good c++ IDE that would offer me visual GUI for developing programs? I am sorry if some of my questions may seem stupid, but i dont want to start coding a program that would take months to develop, just to find out i did something wrong and that it was a better way to do it. Thank you very much in advance!

Is This A Good Question/Topic? 0
  • +

Replies To: vb.net vs. vc++?

#2 janne_panne  Icon User is offline

  • WinRT Dev
  • member icon

Reputation: 428
  • View blog
  • Posts: 1,047
  • Joined: 09-June 09

Re: vb.net vs. vc++?

Posted 15 January 2013 - 06:46 AM

So you are doing that kind of UIs with WinForms? Sounds like a pain in the butt.

How about you switch to WPF instead of C++. Learning curve is smaller and that will guarantee that your controls will be fast because all you are doing above can be done pretty simply with XAML.

For example, here is the Record button (I assumed it was a button) in your code quickly written in XAML:
            <Button BorderThickness="0">
                <StackPanel Orientation="Horizontal" Height="40">
                    <Border Background="Purple" Width="20" />
                    <TextBlock Text="1" FontSize="50" Margin="0,-15,0,0" Foreground="Red" />
                    <Border CornerRadius="0,20,20,0" Width="100" Background="Blue" >
                        <TextBlock Text="RECORD" HorizontalAlignment="Center" VerticalAlignment="Center" />
                    </Border>
                </StackPanel>
            </Button>



No need to write any actual VB code for styling the UI. You can also search for sample UIs done with WPF by using google's image search (search for "WPF ui design" for example)

So I would suggest to create a small sample application with WPF so you know if it's fast enough (should be) and fills your needs. If it doesn't, I doubt that just C++ will either. Writing applications in C++ won't make them fast automatically. Sure, it might give you 10% boost in performance but slow code is still slow.

Btw. Have you tried to figure out why your code runs so slow? Try to set up some StopWatches inside your startup code to see which sections are bottlenecks.
Was This Post Helpful? 1
  • +
  • -

#3 rusoaica  Icon User is offline

  • D.I.C Head

Reputation: 23
  • View blog
  • Posts: 184
  • Joined: 10-March 12

Re: vb.net vs. vc++?

Posted 15 January 2013 - 07:05 AM

i am not "afraid" of a bigger learning curve, as i always enjoy facing "hard" challenges :) However, i will give WPF a shot. Even if i am not too happy giving up the idea of multi platform. Perhaps i should explain in more detail what i (and other programmers) try to accomplish, why the execution is slow and why we struggle so much for cross-platform goals.
So, first of all, that style of interface, buttons, etc is called LCARS and is the style of GUI used on the fictional computer displays and consoles in the TV series "Star Trek". What we started to do was to make a Windows Explorer-like shell, but with that visual interface style. That wasn't pretty hard to achieve. But after that, we wanted something more, so we coded ways of letting the user customize the interface entirely at runtime. This means they could alter the size, position, color, text, etc etc of the buttons and other controls at runtime. Even let the user set some small custom actions that those control did. To make those things possible, the form's load even had a lot of codes to load all the custom settings made by the user for every single control. Imagine that every control had about 20 custom settings to load (as i said, position, color, size, flashing, etc). And also imagine that every form had a few hundred controls. That being said, it self explains why a form would take longer than 10-15 seconds to display. The code inside the load sub looks somehow like this:

 For Each obj As LCARSTerminalControls.Controls.ArrowControl In Me.Controls.OfType(Of LCARSTerminalControls.Controls.ArrowControl)()
            If regKey.GetValue("ARROWDIRECTION_" & Me.Name.ToString & obj.Name.ToString) IsNot Nothing Then
                obj.ArrowDirection = CustomizeModule.ReturnArrowDirection(regKey.GetValue("ARROWDIRECTION_" & Me.Name.ToString & obj.Name.ToString))
            End If
            If regKey.GetValue("POSITION_" & Me.Name.ToString & obj.Name.ToString) IsNot Nothing Then
                Dim SavedPosition As String = CStr(regKey.GetValue("POSITION_" & Me.Name.ToString & obj.Name.ToString))
                obj.Location = New Point(CInt(SavedPosition.ToString.Substring(0, SavedPosition.IndexOf(","))), CInt(SavedPosition.ToString.Substring(SavedPosition.IndexOf(",") + 1)))
            End If
            If regKey.GetValue("SIZE_" & Me.Name.ToString & obj.Name.ToString) IsNot Nothing Then
                Dim SavedPosition As String = CStr(regKey.GetValue("SIZE_" & Me.Name.ToString & obj.Name.ToString))
                obj.Size = New Size(CInt(SavedPosition.ToString.Substring(0, SavedPosition.IndexOf(","))), CInt(SavedPosition.ToString.Substring(SavedPosition.IndexOf(",") + 1)))
            End If
            If regKey.GetValue("COLOR_" & Me.Name.ToString & obj.Name.ToString) IsNot Nothing Then
                CustomizeModule.GetControlColor(obj, Me.Name)
            End If
            If regKey.GetValue("TEXT_" & Me.Name.ToString & obj.Name.ToString) IsNot Nothing Then
                obj.Text = CustomizeModule.ControlText(CStr(regKey.GetValue("TEXT_" & Me.Name.ToString & obj.Name.ToString)))
            End If
            If regKey.GetValue("TEXTSIZE_" & Me.Name.ToString & obj.Name.ToString) IsNot Nothing Then
                obj.ButtonTextHeight = CStr(regKey.GetValue("TEXTSIZE_" & Me.Name.ToString & obj.Name.ToString))
            End If
            If regKey.GetValue("TEXTALIGN_" & Me.Name.ToString & obj.Name.ToString) IsNot Nothing Then
                obj.ButtonTextAlign = CustomizeModule.ReturnTextAlign(CInt(regKey.GetValue("TEXTALIGN_" & Me.Name.ToString & obj.Name.ToString)))
            End If
            If regKey.GetValue("FLASH_" & Me.Name.ToString & obj.Name.ToString) IsNot Nothing Then
                obj.Flash = CType(regKey.GetValue("FLASH_" & Me.Name.ToString & obj.Name.ToString), Boolean)
            End If
            If regKey.GetValue("FLASHINTERVAL_" & Me.Name.ToString & obj.Name.ToString) IsNot Nothing Then
                obj.FlashInterval = CInt(regKey.GetValue("FLASHINTERVAL_" & Me.Name.ToString & obj.Name.ToString))
            End If
            If regKey.GetValue("LIT_" & Me.Name.ToString & obj.Name.ToString) IsNot Nothing Then
                obj.Lit = Not CType(regKey.GetValue("LIT_" & Me.Name.ToString & obj.Name.ToString), Boolean)
            End If
        Next

        For Each obj As LCARSTerminalControls.Controls.DoublePillControl In Me.Controls.OfType(Of LCARSTerminalControls.Controls.DoublePillControl)()
            If regKey.GetValue("POSITION_" & Me.Name.ToString & obj.Name.ToString) IsNot Nothing Then
                Dim SavedPosition As String = CStr(regKey.GetValue("POSITION_" & Me.Name.ToString & obj.Name.ToString))
                obj.Location = New Point(CInt(SavedPosition.ToString.Substring(0, SavedPosition.IndexOf(","))), CInt(SavedPosition.ToString.Substring(SavedPosition.IndexOf(",") + 1)))
            End If
            If regKey.GetValue("SIZE_" & Me.Name.ToString & obj.Name.ToString) IsNot Nothing Then
                Dim SavedPosition As String = CStr(regKey.GetValue("SIZE_" & Me.Name.ToString & obj.Name.ToString))
                obj.Size = New Size(CInt(SavedPosition.ToString.Substring(0, SavedPosition.IndexOf(","))), CInt(SavedPosition.ToString.Substring(SavedPosition.IndexOf(",") + 1)))
            End If
            If regKey.GetValue("COLOR_" & Me.Name.ToString & obj.Name.ToString) IsNot Nothing Then
                CustomizeModule.GetControlColor(obj, Me.Name)
            End If
            If regKey.GetValue("TEXT_" & Me.Name.ToString & obj.Name.ToString) IsNot Nothing Then
                obj.Text = CustomizeModule.ControlText(CStr(regKey.GetValue("TEXT_" & Me.Name.ToString & obj.Name.ToString)))
            End If
            If regKey.GetValue("TEXTSIZE_" & Me.Name.ToString & obj.Name.ToString) IsNot Nothing Then
                obj.ButtonTextHeight = CStr(regKey.GetValue("TEXTSIZE_" & Me.Name.ToString & obj.Name.ToString))
            End If
            If regKey.GetValue("TEXTALIGN_" & Me.Name.ToString & obj.Name.ToString) IsNot Nothing Then
                obj.ButtonTextAlign = CustomizeModule.ReturnTextAlign(CInt(regKey.GetValue("TEXTALIGN_" & Me.Name.ToString & obj.Name.ToString)))
            End If
            If regKey.GetValue("FLASH_" & Me.Name.ToString & obj.Name.ToString) IsNot Nothing Then
                obj.Flash = CType(regKey.GetValue("FLASH_" & Me.Name.ToString & obj.Name.ToString), Boolean)
            End If
            If regKey.GetValue("FLASHINTERVAL_" & Me.Name.ToString & obj.Name.ToString) IsNot Nothing Then
                obj.FlashInterval = CInt(regKey.GetValue("FLASHINTERVAL_" & Me.Name.ToString & obj.Name.ToString))
            End If
            If regKey.GetValue("LIT_" & Me.Name.ToString & obj.Name.ToString) IsNot Nothing Then
                obj.Lit = Not CType(regKey.GetValue("LIT_" & Me.Name.ToString & obj.Name.ToString), Boolean)
            End If
        Next


        For Each obj As LCARSTerminalControls.Controls.ElbowControl In Me.Controls.OfType(Of LCARSTerminalControls.Controls.ElbowControl)()
            If regKey.GetValue("ELBOWSTYLE_" & Me.Name.ToString & obj.Name.ToString) IsNot Nothing Then
                obj.ElbowControlStyle = CustomizeModule.ReturnElbowStyle(regKey.GetValue("ELBOWSTYLE_" & Me.Name.ToString & obj.Name.ToString))
            End If
            If regKey.GetValue("BUTTONHEIGHT_" & Me.Name.ToString & obj.Name.ToString) IsNot Nothing Then
                obj.ButtonHeight = CInt(regKey.GetValue("BUTTONHEIGHT_" & Me.Name.ToString & obj.Name.ToString))
            End If
            If regKey.GetValue("BUTTONWIDTH_" & Me.Name.ToString & obj.Name.ToString) IsNot Nothing Then
                obj.ButtonWidth = CInt(regKey.GetValue("BUTTONWIDTH_" & Me.Name.ToString & obj.Name.ToString))
            End If
            If regKey.GetValue("POSITION_" & Me.Name.ToString & obj.Name.ToString) IsNot Nothing Then
                Dim SavedPosition As String = CStr(regKey.GetValue("POSITION_" & Me.Name.ToString & obj.Name.ToString))
                obj.Location = New Point(CInt(SavedPosition.ToString.Substring(0, SavedPosition.IndexOf(","))), CInt(SavedPosition.ToString.Substring(SavedPosition.IndexOf(",") + 1)))
            End If
            If regKey.GetValue("SIZE_" & Me.Name.ToString & obj.Name.ToString) IsNot Nothing Then
                Dim SavedPosition As String = CStr(regKey.GetValue("SIZE_" & Me.Name.ToString & obj.Name.ToString))
                obj.Size = New Size(CInt(SavedPosition.ToString.Substring(0, SavedPosition.IndexOf(","))), CInt(SavedPosition.ToString.Substring(SavedPosition.IndexOf(",") + 1)))
            End If
            If regKey.GetValue("COLOR_" & Me.Name.ToString & obj.Name.ToString) IsNot Nothing Then
                CustomizeModule.GetControlColor(obj, Me.Name)
            End If
            If regKey.GetValue("TEXT_" & Me.Name.ToString & obj.Name.ToString) IsNot Nothing Then
                obj.Text = CustomizeModule.ControlText(CStr(regKey.GetValue("TEXT_" & Me.Name.ToString & obj.Name.ToString)))
            End If
            If regKey.GetValue("TEXTSIZE_" & Me.Name.ToString & obj.Name.ToString) IsNot Nothing Then
                obj.ButtonTextHeight = CStr(regKey.GetValue("TEXTSIZE_" & Me.Name.ToString & obj.Name.ToString))
            End If
            If regKey.GetValue("TEXTALIGN_" & Me.Name.ToString & obj.Name.ToString) IsNot Nothing Then
                obj.ButtonTextAlign = CustomizeModule.ReturnTextAlign(CInt(regKey.GetValue("TEXTALIGN_" & Me.Name.ToString & obj.Name.ToString)))
            End If
            If regKey.GetValue("FLASH_" & Me.Name.ToString & obj.Name.ToString) IsNot Nothing Then
                obj.Flash = CType(regKey.GetValue("FLASH_" & Me.Name.ToString & obj.Name.ToString), Boolean)
            End If
            If regKey.GetValue("FLASHINTERVAL_" & Me.Name.ToString & obj.Name.ToString) IsNot Nothing Then
                obj.FlashInterval = CInt(regKey.GetValue("FLASHINTERVAL_" & Me.Name.ToString & obj.Name.ToString))
            End If
            If regKey.GetValue("LIT_" & Me.Name.ToString & obj.Name.ToString) IsNot Nothing Then
                obj.Lit = Not CType(regKey.GetValue("LIT_" & Me.Name.ToString & obj.Name.ToString), Boolean)
            End If
        Next
..................................



and that is one of the simplest examples of the codes. Could that be accomplished to be cross - platform? Could that process be speed up by another language (as mentioned above, c++)? Is visual c++ going to make it faster, if using win32 unmanaged code?
Was This Post Helpful? 0
  • +
  • -

#4 baavgai  Icon User is offline

  • Dreaming Coder
  • member icon

Reputation: 5643
  • View blog
  • Posts: 12,359
  • Joined: 16-October 07

Re: vb.net vs. vc++?

Posted 15 January 2013 - 07:10 AM

First you have to figure out where your speed bottlenecks are. In Windows, you will be talking to Windows APIs for display. If you want display speed, talk to DirectX. If you're doing thousands of calculations a second and milliseconds count, then you start looking at architecture. If you're just refreshing buttons in a GUI, then it's probably not an issue.

Right:

View Postrusoaica, on 15 January 2013 - 07:47 AM, said:

However, the program become more and more complex, and now, in the load event of any form, i have hundreds of statements, which makes them take more than 10 seconds to display.


This could be a design issue, which no language will help. If you have a code sample, folks can offer suggestions.

View Postrusoaica, on 15 January 2013 - 07:47 AM, said:

i found out that vb.net can sometimes be pretty slow, because it is "managed" code (?).


This is wrong. Yes, VB.NET managed, but so is much of Windows. Slower than what, exactly? Remember, if you're talking to UI elements in the OS, everyone is then equal.


View Postrusoaica, on 15 January 2013 - 07:47 AM, said:

Some people suggested me i should stick with native c++, which should build programs that execute much faster


Yes, they can be faster. But, if you're talking to UI elements, you're back down to that.

View Postrusoaica, on 15 January 2013 - 07:47 AM, said:

more robust and offer a greater control over the programming.


Robust is an opinion. Greater control? You're in Windows; ultimately, they are in control. Greater control internally is talking about things like memory management. This can be a double edged sword if you don't know what you're doing.

View Postrusoaica, on 15 January 2013 - 07:47 AM, said:

using native code, is the program still dependent on the .net framework?


No, native means it runs directly on the OS. Not the framework, but still windows.

View Postrusoaica, on 15 January 2013 - 07:47 AM, said:

Also, can i make custom controls using native code?


Yep. You're talking to the OS. You'll be reinventing the wheel and it will take some time...

View Postrusoaica, on 15 January 2013 - 07:47 AM, said:

Is native code meaning that my programs would be cross-platform


Not necessarily. Definitely not if you're doing custom controls for Windows API. You could do C++ with something like Qt and then be cross-platform. You'd essentially need a middle tier for your UI logic.

View Postrusoaica, on 15 January 2013 - 07:47 AM, said:

Can i write programs in VC++ containing those custom controls in such way that they won't be .net dependent?


It's all or nothing. You want native C++ or C++.NET? Hint, you never want C++.NET.

Hope this helps.
Was This Post Helpful? 1
  • +
  • -

#5 baavgai  Icon User is offline

  • Dreaming Coder
  • member icon

Reputation: 5643
  • View blog
  • Posts: 12,359
  • Joined: 16-October 07

Re: vb.net vs. vc++?

Posted 15 January 2013 - 07:16 AM

View Postrusoaica, on 15 January 2013 - 09:05 AM, said:

The code inside the load sub looks somehow like this:


Crap, are those all registry reads? Why aren't you reading that stuff in once and only once? You seem to be reading most of them twice.

I would try this without the registry hits and see how fast it gets.
Was This Post Helpful? 0
  • +
  • -

#6 rusoaica  Icon User is offline

  • D.I.C Head

Reputation: 23
  • View blog
  • Posts: 184
  • Joined: 10-March 12

Re: vb.net vs. vc++?

Posted 15 January 2013 - 09:12 AM

yes, the values are stored inside registry (is there a better way to store and retrieve data?), and, if you look closely, you will notice:

 For Each obj As LCARSTerminalControls.Controls.ArrowControl



and

For Each obj As LCARSTerminalControls.Controls.ElbowControl



Those are two different controls, with some different properties. For example, the arrow button control has the property named "arrow dirrection", which the elbow button control does not have. Also, the elbow has the elbow style property, which is not present for the rest of the controls. Thats why it may seem that is repeating, but because they have different properties, i had to take each type of controls and load its settings....
I'm not sure what you meant by "without registry hits". If you mean how it is loading all the controls WITHOUT the custom settings applied by the users, they load fine (3-4 seconds for each form)...
Was This Post Helpful? 0
  • +
  • -

#7 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 8401
  • View blog
  • Posts: 31,266
  • Joined: 12-June 08

Re: vb.net vs. vc++?

Posted 15 January 2013 - 09:29 AM

My.Settings works well.. less of a registry hit.

This smells of bad architecture.

I mean why are these user controls (they are user controls, right?) not doing all the work themselves.. for their own data?

Are you telling me anything that has a bit of color on the startrek interface is loaded up in the main? Dear lord that must be a mess.

Just off the bat I see things like grids, checkbox lists, panels, menus, etc that should be their own control so.. you know.. in the future you just drag and drop them out of your toolbox.
Was This Post Helpful? 1
  • +
  • -

#8 rusoaica  Icon User is offline

  • D.I.C Head

Reputation: 23
  • View blog
  • Posts: 184
  • Joined: 10-March 12

Re: vb.net vs. vc++?

Posted 15 January 2013 - 09:48 AM

this is the class where the custom controls are developed, so you can take a look and say if they were created in a good way or not. That was the best way i could think of implementing them, perhaps i am wrong (far from me the idea of being an expert programmer :)/> ). And yes, they are controls that can be added on a form from the toolbox (the above class was exported as a dynamic link library which was added to the toolbox, afterwards).
This is the way i was thinking to implement this feature of letting the user set some properties at runtime. Lets take for example, the position of a button. When the user right click on a button, it can drag it across the screen. In the mouse up event, there is a piece of code that stores in the registry a key with the name of the form which is the parent of the button, and the name of the button. Something like this: POSITION_Form1Button1. The value of this key is the new position where the button was dropped. I included the name of the parent form and the name of the button because there might be two forms: form1 and form2, which could both have a Button called Button1, and the program wouldnt know for which one of them is the registry key Position_... So, in the load event of the form1, i put that piece of code, which takes all the controls inside it, read the values of the registry keys and sets the position of the controls according to them:

 If regKey.GetValue("POSITION_" & Me.Name.ToString & obj.Name.ToString) IsNot Nothing Then
                Dim SavedPosition As String = CStr(regKey.GetValue("POSITION_" & Me.Name.ToString & obj.Name.ToString))
                obj.Location = New Point(CInt(SavedPosition.ToString.Substring(0, SavedPosition.IndexOf(","))), CInt(SavedPosition.ToString.Substring(SavedPosition.IndexOf(",") + 1)))
            End If



Is my approach faulty? Is there a better way to let the user set all the properties of a control at runtime and load them again when the program starts? A demonstration of my program can be found here, the archive named "LCARS Terminal".
Was This Post Helpful? 0
  • +
  • -

#9 rusoaica  Icon User is offline

  • D.I.C Head

Reputation: 23
  • View blog
  • Posts: 184
  • Joined: 10-March 12

Re: vb.net vs. vc++?

Posted 15 January 2013 - 09:53 AM

sorry, i forgot to add a link to the class :online2long: you can view it here
Was This Post Helpful? 0
  • +
  • -

#10 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 8401
  • View blog
  • Posts: 31,266
  • Joined: 12-June 08

Re: vb.net vs. vc++?

Posted 15 January 2013 - 10:07 AM

Eekgads.. yeah.. that is not the route I would take. Again.. having everything in one file/control is.. icky.

Let each user control deal with loading it's image.. and dealing with their events for a sound click.. and so forth.

Things like the 'red alert' property would be an event the controls would catch (after it is raised) and act accordingly.

Then.. even with things in one control.. you are not using some of the obvious cheats.. like drawing of the buttons and what not.. why not pass the graphics object from the main form down to everyone? If things were separate you could easily just make the bitmap memory chunk once (at the start of the app) and not recreate it every time you draw.


So the other question is what is the point of your app? Does it do something specific? Why is the user changing the button location?
Was This Post Helpful? 1
  • +
  • -

#11 rusoaica  Icon User is offline

  • D.I.C Head

Reputation: 23
  • View blog
  • Posts: 184
  • Joined: 10-March 12

Re: vb.net vs. vc++?

Posted 15 January 2013 - 10:29 AM

the goal of the application was initially to make a replacement for the Windows Explorer, so a user could use the computer on a daily basics of functionality, without seeing any piece of Windows styles or controls. And, NO, we didn't want to just use a windows theme! Also, to add more functionality to that daily computer usage. For example, our Terminal's Start Menu (similar to the windows start menu) is in LCARS style and not only that launches files, but also speaks a phrase upon lauching them (through a texttospeech engine). Or can be controlled with custom voice commands. That is just a small example. The overall goal was to be able to use the computer with THAT LCARS user interface, and add a "star trek computer" futuristic feeling. I mention that this project is open source and is created for a fairly large community of users that are trekkies :)/> So, a lot of these users asked for the customization feature, to let them set the colors, positions, actions of these controls. We tried our way. Seems it is a little bit wrong in its approach. I am open to new suggestions. Meanwhile, watch this youtube video. Isn't that just worth trying to make a computer work that way?

This post has been edited by rusoaica: 15 January 2013 - 10:30 AM

Was This Post Helpful? 0
  • +
  • -

#12 baavgai  Icon User is offline

  • Dreaming Coder
  • member icon

Reputation: 5643
  • View blog
  • Posts: 12,359
  • Joined: 16-October 07

Re: vb.net vs. vc++?

Posted 15 January 2013 - 10:39 AM

e.g. This is two hits:
If regKey.GetValue("POSITION_" & Me.Name.ToString & obj.Name.ToString) IsNot Nothing Then
	Dim SavedPosition As String = CStr(regKey.GetValue("POSITION_" & Me.Name.ToString & obj.Name.ToString))
	obj.Location = New Point(CInt(SavedPosition.ToString.Substring(0, SavedPosition.IndexOf(","))), CInt(SavedPosition.ToString.Substring(SavedPosition.IndexOf(",") + 1)))
End If



This is one hit:
Dim objLocationValue = regKey.GetValue("POSITION_" & Me.Name.ToString & obj.Name.ToString)
If objLocationValue IsNot Nothing Then
	Dim SavedPosition As String = CStr(objLocationValue)
	obj.Location = New Point(CInt(SavedPosition.Substring(0, SavedPosition.IndexOf(","))), CInt(SavedPosition.Substring(SavedPosition.IndexOf(",") + 1)))
End If




I would use a caching object for this, so I could just pass the parts that change:
REM PropertyMangager - a custom object to cache values and abstract access
REM PropertyInstanceMangager - a custom object used for a given form
Dim Pim As PropertyInstanceMangager = PropertyMangager.GetManager(Me.Name)

obj.ArrowDirection = Pim.Get(obj.ArrowDirection, obj, "ARROWDIRECTION")
obj.Location = Pim.Get(obj.Location, obj, "POSITION")
obj.Size = Pim.Get(obj.Size, obj, "SIZE")
obj.Color = Pim.Get(obj.Color, obj, "COLOR")
obj.Text = Pim.Get(obj.Text, obj, "TEXT")



The idea here is pretty straight forward. You pass the default value, which also gives the object context, Point, Text, etc. You pass the object itself, mostly for name, you could probably skip that, and then you pass the property name. Your object does the lookup. If this has already been looked up, you just pass back the value. If never looked up, you try to look it up. You store the retrieved value or default value if none was retrieved. You pass back the value.

There are a number of ways to do this, but the most important element here is that the UI part of your code is freed from worrying about it and you never lookup twice. In the guts of your PropertyMangager implementation, you can decide where those values are persisted. It needn't, and probably shouldn't, be the registry.
Was This Post Helpful? 1
  • +
  • -

#13 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 8401
  • View blog
  • Posts: 31,266
  • Joined: 12-June 08

Re: vb.net vs. vc++?

Posted 15 January 2013 - 10:43 AM

Quote

the goal of the application was initially to make a replacement for the Windows Explorer, so a user could use the computer on a daily basics of functionality

That adds some context, but I hope the "daily basics" is discretely defined.

Quote

Also, to add more functionality to that daily computer usage.

That seems like a tall order. Why not reskin a linux OS? I mean let's face it. .this is just an app sitting ontop of windows... mimicking features are fine, but trying to mask (and not re-theme) it will just butt up against it harder.

Quote

Seems it is a little bit wrong in its approach. I am open to new suggestions.

Break things down into user controls. Review how you are loading your bitmaps.. minimize having to load a hundred things over and over and over again.

[quote]So, a lot of these users asked for the customization feature, [quote]
Some days you gotta say 'no'.

Quote

meanwhile, watch this youtube video. Isn't that just worth trying to make a computer work that way?

I am not sure what I am supposed to be getting out of that clip. I mean look at all the UI panels - those are darn static. Having people throw things all willy nilly like definite runs against the grain. It would almost be worth working in discrete screens.
Was This Post Helpful? 1
  • +
  • -

#14 rusoaica  Icon User is offline

  • D.I.C Head

Reputation: 23
  • View blog
  • Posts: 184
  • Joined: 10-March 12

Re: vb.net vs. vc++?

Posted 15 January 2013 - 10:58 AM

@baavgai - whyle i have never used PropertyMangager, it seems interesting and i will definitely going to give it a chance! thanks a lot for the tip, i will document myself about this class and try to adapt to my needs based on your example. I hope i won't abuse too much of your help if i stumble across something i do not understand and come back for help :)/>
@modi123_1 - even if the idea of having an "LCARS" OS was pretty appealing to us from the beginning, none of us have experience with Linux. Also, there aren't much users ready to start learning it and give up windows (even if Windows sucks, i know :)/> )
I will also try to "break them into user controls" as you said, even if i dont fully comprehend what you meant by that. As i said, any piece of advice from a more experienced programmer is very welcome!
As for the video, i was mainly referring to the functionality of such a computer, its easiness in usage. For the visual part, i guess you must be a trekkie fanatic to see its simplicity and beauty ;)/> But, trust me, there is a huge community of people loving that interface style. And, because we assumed the job of creating such an interface FOR THEM, it is our "prime directive" to listen to their requests. Such as the customization feature. Not to mention that lcars IS very adaptable and customizable.

This post has been edited by rusoaica: 15 January 2013 - 10:59 AM

Was This Post Helpful? 0
  • +
  • -

#15 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 8401
  • View blog
  • Posts: 31,266
  • Joined: 12-June 08

Re: vb.net vs. vc++?

Posted 15 January 2013 - 11:08 AM

Quote

I will also try to "break them into user controls" as you said, even if i dont fully comprehend what you meant by that

For Pete's sake.. user controls. You know.. you are in your project.. you right click on the solution -> add -> user controls.

You know.. using objects and compartmentalizing your logic.

Quote

nd, because we assumed the job of creating such an interface FOR THEM, it is our "prime directive" to listen to their requests.

That sounds like a bit of lazy project management. If a ton of people are throwing suggestions then it's your job, as the project gate keepers, to sort out feasible from not... widely used updates vs single one offs.. good ideas from bad.. etc. Guide the build and don't let the whims of the masses bloat and destroy it.

Quote

As for the video, i was mainly referring to the functionality of such a computer, its easiness in usage. For the visual part, i guess you must be a trekkie fanatic to see its simplicity and beauty

Again.. they have fairly static screens across the board. Hence why they can get away with making swoopie curved panel outlines and such.
Was This Post Helpful? 1
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2