Jump to content
Xtreme .Net Talk

PetCar

Members
  • Posts

    15
  • Joined

  • Last visited

About PetCar

  • Birthday 12/02/1973

PetCar's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. I doubt that. I installed my new notebook today and i got the lastest XP fixes etc. on the machine. I dont want to block script-errors etc. just because there are. All other forums works just fine.. but not this one. // Peter
  2. Well, i got two forms that i want to use the same class to call common functions. I got it to work as i wanted. Thanks! What i did in my real project was attaching a notfyicon on the frmMain, and i wanted to get to that via the class. But now i realize i must do this the other way around. What is the best way to create an application that need to access this notifyicon from all classes and forms? Shall i start the project from a class (Sub Main) and then start all forms from there. As it is right now i use frmMain as startup object. Feedback? // Peter
  3. I got you. But how can i call this class from both frmMain and frmSettings? Isnt the class bound to use only frmMain with your suggestion? // Peter
  4. Yeah.. same here. Im getting pretty annoyed. Please go back to the old forum! :( When trying to post this message first i got: Invalid Thread specified. If you followed a valid link, please notify the webmaster
  5. How do i reuse a class from withing two diffrent forms? clsCommon is to be used with both frmMain and frmSettings, but when starting the second form (frmSettings) i get "Specified cast is not valid". The code i use is: #clsCommon Public Class clsCommon Private objForm As frmMain Public Sub New(ByVal objCallingForm As Form) objForm = objCallingForm End Sub Public Sub DoSomething() objForm.change_form_in_some_way End Sub End Class #frmMain Public Class frmMain Inherits System.Windows.Forms.Form Private clsCommon As New clsCommon(Me) Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click Dim frmSettings As New frmSettings frmSettings.Show() End Sub End Class #frmSettings Public Class frmSettings Inherits System.Windows.Forms.Form Private clsCommon As New clsCommon(Me) Private Sub frmSettings_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 'clsCommon.ShowUserMessage(0, , "Hej hej", True, False) End Sub End Class When clicking button4 to show the frmSettings i get the error "Specified cast is not valid". I know that there is some error in clsCommon: Private objForm As frmMain But how can i do this different? Im so into the old VB6 that my mind is twisted.. :( Thanks! // Peter
  6. Thanks alot guys!! Now im on track again :) I got a big project comming up that have to be done in .net so i have to play around with this "new" OOP. VB6 has infected my brain :) // Peter
  7. I want to create procedures and functions for showing a notifier popup, change the statusbar text etc. How do you mean? I have been programming VB6 for way to long.. :) // Peter
  8. Thanks! I got it to work.. with a class. But is this the right procedure? #Form1 Public Class Form1 Inherits System.Windows.Forms.Form Private otherClass As New Class1(Me) Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click otherClass.ShowTextContent() End Sub End Class #Class1 Public Class Class1 Private callingForm As Form1 Public Sub New(ByVal newCallingForm As Form) callingForm = newCallingForm End Sub Public Sub ShowTextContent() callingForm.TextBox1.Text = "Hello World!" End Sub End Class Thanks! // Peter
  9. Why doesnt people use the code tag. Reading untaged code is very annoying. Please.. use it! :) // Peter
  10. Hi, this question have been asked before.. but i dont get it. Ive searched the forum A LOT of times for questions related to mine. I want to use a module with common functions to edit controls on forms. The code i got right now: # Form1 Public Class Form1 Inherits System.Windows.Forms.Form Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click ModuleTestFunction() End Sub End Class #Module1 Module Module1 Public frm1 As New Form1 Public Function ModuleTestFunction() As Object frm1.TextBox1.Text = "Hello World!" End Function End Module When clicking the button, nothing happends. If i put an msgbox into the function, it will show up, but the textbox remains unchanged. Can anyone please tell me what i do wrong? Thanks! // Peter
  11. Thanks alot! That did help me! :) // Peter
  12. How do i throw an exeption? All i get on client side is an error message. What i want to do is show something like: <xml> <errormessage>File ID not found</errormessage> </xml> // Peter
  13. Hi, im quite new to XML, Soap and .NET. i got a question on how i can return a custom error when my database search didnt find anything. This is the code so far... <WebMethod()> Public Function WebSync_GetFileInfo(ByVal intFileID As Integer) As DataSet Dim strSQLConnectionString As String = "user id=ws;password=ws;initial catalog=misc;data source=127.0.0.1" Dim objSQLConnection As New SqlConnection(strSQLConnectionString) Dim strSQLQuery As String strSQLQuery = "SELECT * FROM files_files WHERE files_id = " & intFileID Dim mySQLCommand As SqlDataAdapter = New SqlDataAdapter(strSQLQuery, objSQLConnection) Dim dsFiles As New DataSet() mySQLCommand.Fill(dsFiles, "files_id") Dim MyTable As New DataTable() MyTable = dsFiles.Tables(0) If MyTable.Rows.Count = 0 Then 'Show some kind of error message Else Return dsFiles End If End Function What i want to do is to show a custom errormessage in XML when no files where found in the database. But i cant return a string when the function expects to receive a dataset. How can i show an error in xml instead of Nothing? Thanks! // Peter
  14. I have made a chart in an aspx page, and i want to show this on my asp page. I saw Dereks answer, but i quite new to asp.net so i dont know where to put the lines. Page_Load? // Peter
  15. Hi, is there anyway to show an aspx-page as an image on a .asp page? ..or if there is a way to "include" the output from an aspx page on a .asp page? Need urgent help.. Thanks! // Peter
×
×
  • Create New...