Jump to content
Xtreme .Net Talk

PlausiblyDamp

Administrators
  • Posts

    7016
  • Joined

  • Last visited

Everything posted by PlausiblyDamp

  1. Pure code libraries can be compiled into a dll that can be shared between multiple applications. User controls can be a good replacement for include files when you need to share parts of the UI between multiple pages in the same app. More complex functionality & UI could be compiled into a Custom Web control. Could you give a bit more details about what you need to do?
  2. You did ask the question on a .Net forum - what language did you expect the answer to be in? http://www.visualbasicforum.com/ may be a better place to post a VB6 question
  3. What's the name of your DataSet? The code should look like .Tables(0).Rows(2).Item("question_txt")
  4. You get the error running the project as included in the zip file? Works fine for myself..... If you mean in your own project could you post the relevant code?
  5. Could you post the code you are using (declares etc) - alos the VB6 version if possible.
  6. What line of code do you get the exception on? If _form Is Nothing Then _form = New Form3 ElseIf _form.IsDisposed Then _form = New Form3 End If _form.Show() _form.valueFromAnotherForm = TextBox1.Text the code says if _form hasn't been set (is nothing) then create a new instance. If a user closes the form (hitting the X for example) the _form variable will not be nothing but neither will the form be usable (_form.IsDisposed) - so create a new instance. Any other condition means we have a usable form instance so we just use it. Once you get the idea of object orientated code then you realise the little bit of extra work you have to do does result in a vastly more powerful / flexible language.
  7. Did you look at the code behind the 3rd button down (labelled re-use form)? The form has a form level variable of type form3, the button checks if the form exists already and if it doesn't then it creates a new instance, if it already exists then the same instance is re-used.
  8. Are all the forms part of the same project (i.e. compiled into the .exe itself)? If so what is the namespace of the application (Project menu,properties on the right - root namespace) You need to fully qualify the form name with the correct namespace for this to work. If it doesn't work could you post some code to show where / how it is failing for you.
  9. Very nice so far, only had a quick look but I'm impressed.
  10. Dim ctl As Control For Each ctl In Me.XpePanel4.Controls ' Tasks if typeof(ctl) is TextBox then Dim t as textbox= directcast(ctl,TextBox) if t.tag = 1 then t.readonly = true else t.readonly = false end if end if next You will get this error if some of the controls on the form are not TextBoxes - the code above will loop through the controls but not expect them to be textboxes, if they are then we deal with them correctly.
  11. Create a new project and add a few forms to it. On your startup form add a button and a textbox. Paste the following code into the button click event. Dim f As Form Dim a As System.Reflection.Assembly a = System.Reflection.Assembly.GetExecutingAssembly() f = a.CreateInstance(TextBox1.Text) f.Show() You will need to type the full classname of the form to display into the textbox. i.e. WindowsApplication1.Form2 However is there any reason why you need to do it this way?
  12. try the 3rd button down on this modified version - any use?forms.zip
  13. http://www.xtremedotnettalk.com/showthread.php?s=&threadid=82585 Also could you please not double post your questions.
  14. given a class like Public Class UserConfig Public val1 As Integer = 1 Public val2 As String = "Hello" Public val3 As Date = Now End Class it could be serialized with code like 'to save Dim f As New System.IO.FileStream("c:\test.xml", IO.FileMode.Create) Dim x As New System.Xml.Serialization.XmlSerializer(GetType(UserConfig)) Dim u As New UserConfig x.Serialize(f, u) f.Close() 'to load Dim f2 As New System.IO.FileStream("c:\test.xml", IO.FileMode.Open) Dim x2 As New System.Xml.Serialization.XmlSerializer(GetType(UserConfig)) Dim u2 As UserConfig u2 = x.Deserialize(f2) f.Close() just store it in the places I mentioned above rather than the c:\test.xml I've hard-coded
  15. There are ways round it but by design the .config file is really for admin use, if your app is running under XP or later (not sure of win2k) then a normal user will not have write privelleges to the apps install folder. If you wish to store user settings then saving the info to a XML file using XMLSerialisation is pretty easy. This file can be stored as part of the users profile by saving it in a sub-folder of the path returned by system.Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) this will allow every user to have their own settings or by using System.Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) information can be shared by all users. You could also store information in all 3 places depending on if it's admin stuff (.config), individual user info (ApplicationData) or shared config (CommonApplicationData)
  16. Registry can only be edit with certain tools, usually it isn't cleaned up after an application is un-installed, if you move your app to another machine then it's hard to get registry settings to move as well. The little sample attached should give you an idea: Note the name of the file under VS is called app.config, however at runtime the file needs to be called (yourappname.exe.config - VS takes care of this for you). Build the sample and go to the bin directory generated and run the exe, click the button and see what the label is set to. Edit the .config file in any text editor and click the button again (remembering to save the file!) appconfig.zip
  17. If you are using a windows app you can store it in the app.config file, or use web.config if it is a web app.
  18. Could you be a bit more specific about what you are trying to achieve? If you simply want a control that looks like explorer then .Net has the ListView control....
  19. find two quick ways attached. One overloads the form's sub new (see form2) one uses a property (see form3) forms.zip
  20. You may find a Hardware based forum could be of more help, as Sam said a lot of things could be at fault. http://www.extremetechsupport.org/forum may be worth a try ( a few of the names from here will be familiar over there as well)
  21. If the variable is declared local to the DrivingRange button's click event then it cannot be seen from another sub or function in the class, static or not. Can't think of any other way than using class level variables myself.
  22. Could you post the code you have now?
  23. Is there any reason why you don't want to use the build in Array.Sort? You would just need to implement the IComparable interface. Public Structure blah Implements IComparable Public x, y As Integer Public Function CompareTo(ByVal obj As Object) As Integer Implements System.IComparable.CompareTo If Not TypeOf obj Is blah Then Throw New InvalidOperationException("Can only compare to Blah things") End If Dim b As blah = DirectCast(obj, blah) If Me.x > b.x Then Return 1 If Me.x < b.x Then Return -1 Return 0 End Function End Structure Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim arr(4) As blah 'populate arr() Dim r As New Random arr(0).x = r.Next arr(1).x = r.Next arr(2).x = r.Next arr(3).x = r.Next arr(4).x = r.Next Array.Sort(arr) End Sub
  24. In fact you could reduce my code down to Private Sub MenuItem3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem3.Click MenuItem3.Checked = Not MenuItem3.Checked Me.TopMost = MenuItem3.Checked End Sub
  25. Could you give a bit more / clearer details on what you are trying to do?
×
×
  • Create New...