
mcerk
Avatar/Signature-
Posts
78 -
Joined
-
Last visited
Content Type
Profiles
Forums
Blogs
Events
Articles
Resources
Downloads
Gallery
Everything posted by mcerk
-
I'd like to create a property which can only have a few flags. Dim _stat As Integer Enum status As Integer DefaultStatus = 0 NotConnected = 1 Running = 2 Stopped = 3 Paused = 4 End Enum Private Property ChangeStatus() As Integer Get Return _stat End Get Set(ByVal ValueAs Integer) _stat = Value End Set End Property How can I achieve that you can only change to predefined status values? tx matej
-
Hi I want to change icon at runtime. How can I do it? I do not care if I read it from file or from some kind of imagelist, but when I wanted to fill imagelist there was an error: 'Invalid parameter used'. I use .ico files (3 icon resources in each - 16x16x24b, 32x32x24b, 48x48x24b) tx, matej
-
Ok, I'd like to read the title in the pdf file. I believe that it can be read using Adobe Acrobat 7 Type Library So I want to read GetInfo("Title") property, and I do not know how. Here are some VB6 samples (and acrobat 6.0) 'acrobat 5.0 Dim x As String x = InputBox("Enter complete path to PDF File") Dim opdf As Acrobat.CAcroPDDoc Set opdf = CreateObject("AcroExch.PDDoc") opdf.Open (x) Dim y As String y = opdf.GetInfo("Title") MsgBox y Set opdf = Nothing 'acrobat 6.0 Dim x As String x = InputBox("Enter complete path to PDF File") Dim opdf As Object Set opdf = CreateObject("AcroExch.PDDoc") opdf.Open (x) Dim y As String y = opdf.GetInfo("Title") MsgBox y Set opdf = Nothing
-
I'd like to read version of windows (and service packs) my client is using. tx
-
I checked this article, and copies vb code into empty module. Set startupform Sub Main and run. But it doesn't handle second errror. So what is wrong? I do not understand what permissions I need. tx in advance (for lazy ones - here is the code) Sub Main() Dim currentDomain As AppDomain = AppDomain.CurrentDomain AddHandler currentDomain.UnhandledException, AddressOf MyHandler Try Throw New Exception("1") Catch e As Exception Console.WriteLine("Catch clause caught : " + e.Message) End Try Throw New Exception("2") ' Output: ' Catch clause caught : 1 ' MyHandler caught : 2 End Sub 'Main Sub MyHandler(sender As Object, args As UnhandledExceptionEventArgs) Dim e As Exception = DirectCast(args.ExceptionObject, Exception) Console.WriteLine("MyHandler caught : " + e.Message) End Sub 'MyUnhandledExceptionEventHandler and remarks
-
Hi. Is it possible to catch every error that occures? I'd like to create a Error tracker, so when error occures it should send me err.number, err.description etc... So one way is: In every procedure and every function I create: Private Sub On Error goto _error ... Exit sub _error: 'here I would send error's End Sub But I think that this is very old fashioned... And, if I use on error, then I can not use Try...Catch statements.... the other way is this (in every sub and every function): Private Sub Try ... Catch ex as Exeption 'here I would send error's End Try End Sub But this is not what I want. Is there any way to do it more fluently. For ex. to catch any occured error in one place? (not in each procedure or function). tx matej
-
I'd like to disable all MenuItems (menu File, Edit, View, Help, etc..) I have a function which disables all controls in a container: 'Function that Disables or Enables all controls in a container control Public Sub EnableDisableObject(ByVal Enable As Boolean, ByVal Container As Control) Dim Control As Control For Each Control In Container.Controls Control.Enabled = Enable Next End Sub but the problem is that MenuItem is not a controll. How can I do it? tx a lot matej
-
Hi. How can I copy all files in folder (and subfolders to another location?) I know how to use FileCopy or Kill functions. tx a lot matej
-
Hi. I have a problem. I'm using SQL data adapter to connect to the database. It works fine, but when I want to uprate it, it returns an error. Can you please help me? Here is the code: Select Case SaveAction Case "Edit" 'edit Dim CurrentRow As DataRow CurrentRow = Me.DsUsers1.HY_Users.Rows(Me.BindingContext(Me.DsUsers1.HY_Users).Position) With CurrentRow .BeginEdit() .Item("Name") = Me.txtName.Text .Item("Surname") = Me.txtSurname.Text .Item("Email") = Me.txtEmail.Text .Item("UsernameWeb") = Me.txtUsernameWeb.Text .Item("Password") = Me.txtPassword.Text .Item("PinCode") = CInt(Me.txtPINCode.Text) .Item("UserLevel") = CInt(Me.txtUserlevel.Text) .EndEdit() End With Case "Insert" 'insert Dim NewRow As DataRow NewRow = Me.DsUsers1.HY_Users.NewRow With NewRow .Item("Name") = Me.txtName.Text .Item("Surname") = Me.txtSurname.Text .Item("Email") = Me.txtEmail.Text .Item("UsernameWeb") = Me.txtUsernameWeb.Text .Item("Password") = Me.txtPassword.Text .Item("PinCode") = Me.txtPINCode.Text .Item("UserLevel") = Me.txtUserlevel.Text End With Me.DsUsers1.HY_Users.Rows.Add(NewRow) Case "" Case Else PopupBox("DEVELOPER MESSAGE, SaveAction does not exist") End Select SaveAction = "" Me.SqlDataAdapter1.Update(Me.DsUsers1, "HY_Users") 'UNDONE: There it returns this error: 'An unhandled exception of type 'System.Data.SqlClient.SqlException' occurred in system.data.dll 'Additional information: System error.
-
OK, I have a touch screen keyboard, but I'd like to emulate keyboard with this buttons. What do I have to call within button_click? tx matej
-
So, I have one string: NameSurname = "John Doe" how can I separate it to: Name = "John" Surname = "Doe" tx a lot matej
-
Ok, but there are similar examples in vb. if you start Form2 from Form1 by dim f as new form2 f.show ...the code will continue but if you start it as dialog f.showdialog then the code stops and continues when form is closed... is it possible to do something similar with control?
-
I can do it by declaring Public Event ReturnValue(AllowLogin as boolean) in the control. And then Fireing it from needed location in the control. I can then catch it in a Form1. But this is not so elegant solution.......
-
I know that. But How can I use click event? You have to imagine, that I'm calling control from form1 (let's say from Form_Load). So I Call method: MyControl.GetUser (and in the control's aspect of view this is just a function) so, when this function finishes the code continues to next step (in the form) and that is what I don't want hm. it's hard to actually display it, but I think I did it better on top of the page in the question.
-
this looks nice, I'm sure it is not only solution, but I can try it. do you know how much resources (cpu, ram) takes this action? is it a lot, or is it not noticable? tx m
-
I can not call it from Form1 in that case. I have to fire method from Form. The button is, as I said on the control.... If I would call it from Form1, Textbox.text value would be in that case "". the problem is, that I do not want the code to continue to '*** (Form1) until user typed his name Is it possibly to somehow wait in the middle of code and continue when Button_Click event occures? (if a procedure in control stops, code continues to run in the form and goes to '***....) PS: (see above post for '*** section)
-
OK, the subject is a little strange, but anyway. I have a custom control that takes user data. But I'm not sure how to wait until user fills his textbox and presses button. MyControl is placed on Form1. Ok, here is example code 'i'm calling MyControl's GetUser method. It returns True or false. 'the code is located in Form1 If MyControl.GetUser = true '..... Else '...... End if '............ '*** '........ ---------------------------------------------- 'ok, and here is code for MyControl's GetUser method 'located in MyControl Public Functin GetUser() as Boolean 'here I have to wait until user fills textbox (located on MyControl) and presses button (allso located on MyControl). 'so, when button is pressed the function shluld continue and return desired value If textbox.text <> "Matej" then Return True Else Return False End If End Function OK. I think that my question is quite understandable. I have to stop in the middle of code and wait until the button is pressed. Is it possible? tx Matej
-
I See. but in TextChanged event I can not use: e.Handled = True So I solved pasting problem with some other procedure... Do you have more elegant solution?
-
ok, I did it right now and it works perfectly tx
-
tx, this works perfectly
-
I tried this, but it doesn't worlk. The values are still 0.
-
I tried this, but this thing somehow doesn't work. The problem is, that when KeyDown event is triggered, the key (char) is allready displayed in textbox
-
Hi. I created Min and Max property in my custom control. I'd like them to have default values. How can I do it? Public Property Max() As Long Get Max = _Max End Get Set(ByVal Value As Long) _Max = Value End Set End Property
-
Hi. I'm triing to do my own textbox that would allow only numeric characters to be displayed (and it will allso allow . and ,). So. I can prevent this characters to be pressed? how can I do it? I wrote some code, but I don't think it will go this way. thank you a lot Private Sub myTextBox_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown 'if not pressed a key between 0 and 9 or , or . If Not (e.KeyValue >= 96 And e.KeyValue <= 105) Or e.KeyValue = 190 Or e.KeyValue = 188 Then 'how can I erase pressed key? or is there better way of doing it? End If End Sub
-
ok, I can be specific. I'm trying to create install with Inno Setup. And I'd like to install (bundle Crystal Reports dll's for Visual Studio .NET 2003). The problem is, that this dlls are not included into .NET Framework. And allso - I do not know which dll's need to be installed. So, I would like to create a package of this dll's with other setup (for ex. VS.NET) and then run it (silently) from Inno Setup.