February 2, 2016, 11:31 am
Hi,
I am about to start a new project and when the dialog opened it had,
Windows Forms Application and WPF Application.
What's the difference and when would you use one over the other?
In my next project, for two or more players or players and computer, I want to have some animation a couple of buttons score cards (one for each player) and a couple of labels.
I think that's about it, until I start and decide to add more features that I haven't thought of yet.
Thanks for looking.
↧
February 2, 2016, 12:24 pm
I am trying to make a program that calculates the system active time amount. This program would calculate the total amount of system active time and idle time. From power options monitor turn off display status. How can we learn if the monitor is on or off with code. If there is a program that can show the window active time amount so that I will not create a program from beginning
Thanks in advance
↧
↧
February 2, 2016, 6:24 pm
Hello, I am working on a NAS kinda program, and shares bunch of files, what I want is, the users can open the files but will not be able to edit them, as in files i mean any kind of, like word, excel, powerpoint etc. but i can ope them as process but cannot add read-only and with excel.application thing, the excel.workbooks.open does not seem to open the file, and further more when i give access to the files, is there any chance the files can be edited simultaneously? Thank you.........
↧
February 2, 2016, 10:01 pm
I'm copying an array of subfolders and array of files of the subfolders, the process is successful, but the files that are copied has no size. the 60 MB file became 0 bytes after being copied to another directory, what could be wrong? :cry:
this Is my code:
Code:
Dim WithEvents WebCopy As New WebClient
Dim foldersToCopy As New ArrayList()
Dim filesOfSub As New ArrayList()
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
foldersToCopy.Clear()
filesOfSub.Clear()
Dim src As String = Form2.TextBox1.Text
Dim dest As String = Form2.TextBox2.Text
Dim di As DirectoryInfo = New DirectoryInfo(src)
Dim dii As DirectoryInfo = New DirectoryInfo(dest)
' this is where I get the subfolders and its files.
For Each sd In di.GetDirectories
For Each fi In sd.GetFiles
If Not Directory.Exists(dest & "\" & sd.Name) And Not File.Exists(dest & "\" & fi.Name) Then
foldersToCopy.Add(sd.Name)
filesOfSub.Add(fi.Name)
End If
Next
Next
' this is where I create the subfolders
For i = 0 To foldersToCopy.Count - 1
If Not Directory.Exists(dest & "\" & dii.Name) Then
Directory.CreateDirectory(dest & "\" & foldersToCopy(i))
End If
Next
' this is where I copy the files of subfolders
For i = 0 To filesOfSub.Count - 1
Dim WebCopy As WebClient = New WebClient
WebCopy.DownloadFileAsync(New Uri(src & "\" & filesOfSub(i)), dest & "\" & foldersToCopy(i) & "\" & filesOfSub(i))
Next
End Sub
Btw, I'm using WebClient for its smooth progress bar and convinient use of handlers.
↧
February 2, 2016, 11:15 pm
Hi Guys
I want to load a programme say programme "A"
from the code of say programme "B"
I think I have to use the Shell as in Shell("c:\programme A.exe")
Will this work ???????
Thanks.... Phlippy
↧
↧
February 3, 2016, 1:06 am
Hi!
We are currently developing a vb.net component (class library) that wraps a serialport that communicates to some hardware through modbus. The basic features of this api should be:
1) Provide a set of API functions to invoke certain operations on the hardware (startprocess, stopprocess, changefrequency, getcurrenttemperature)
2) Provide continuous error monitoring and error reporting.
We have 1) already implemented, and we have a rather large set of custom exceptions designed and implemented to catch errors in serial port, modbus etc.
The trick is #2, continous error monitoring. The hardware has built in error monitoring, and writes certain registrys whenever something is wrong, for example the temperature is too high. It then writes an error code and an error status. The component should poll this registry every 1 second and report back if there is an error, then we should handle this and maybe stop the process, change the UI of the calling application, log the error etc.
What is the best way to implement this? Our idea is to have two methods on the API
await myAPI.StartErrorMonitoring()
await myAPI.EndErrorMonitoring()
The first method starts an async task and also exposes an event EquipmentErrorEvent. The caller subscribes to this event, and whenever an error has occured, gets notified through an event handler and can take action. We have numerous issues with this:
* Should the API keep raising events or what should happen after an error event has been raised the first time? Should the API raise an error event for the exact same error?
* If we perform some kind of action (ChangeProcess) and this raises an exception due to a hardware error, we get both an exception from ChangeProcess and an event from the monitoring process. We get a lot of error reporting to orchestrate. Are we making things too complicated for us?
* Should we use the "old" eventhandlers for this? I have read that it doesn't work too well with async/await
Do please provide some input on the current design of the component, and if it can be simplified further?
/H
↧
February 3, 2016, 2:35 am
Whit this code I can take image coppy of PrintDocumet.
Code:
'>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Option Strict Off
Public Class Form1
Dim pdoc As New Printing.PrintDocument()
Friend WithEvents ppc As New Printing.PreviewPrintController()
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
pdoc.PrintController = ppc
AddHandler pdoc.PrintPage, AddressOf pdoc_PrintPage
AddHandler pdoc.EndPrint, AddressOf xxx
' This shows nothing on the screen. It ends
' up calling the 'xxx' sub which saves the
' printpage images to files
pdoc.Print()
' This will show a regular print preview
pdoc.PrintController = New Printing.StandardPrintController
Dim ppd As New PrintPreviewDialog
ppd.Document = pdoc
ppd.ShowDialog()
End Sub
Private Sub pdoc_PrintPage(ByVal sender As Object, ByVal e As Printing.PrintPageEventArgs)
Static z As Integer = 0
If z = 0 Then
e.Graphics.DrawString("Page pg1", New Font("Arial", 48), Brushes.Black, New PointF(100, 100))
z += 1
e.HasMorePages = True
ElseIf z = 1 Then
e.Graphics.DrawString("Page pg2", New Font("Arial", 48), Brushes.Black, New PointF(100, 100))
z += 1
e.HasMorePages = True
Else
e.Graphics.DrawString("Page pg3", New Font("Arial", 48), Brushes.Black, New PointF(100, 100))
e.HasMorePages = False
z = 0
End If
End Sub
Private Sub xxx(ByVal sender As Object, ByVal e As System.Drawing.Printing.PrintEventArgs)
Dim ppi() As Printing.PreviewPageInfo = ppc.GetPreviewPageInfo()
For x As Integer = 0 To ppi.Length - 1
ppi(x).Image.Save("F:\look" & x.ToString & ".jpg")
Next
End Sub
'>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
First. how can I take image coppy of printdocument in a memory as temp file in the memory for after delete automaticly.
And Second. How can I load this image coppies into Picturebox. ?
Code take image with string name Look1, Look2, Look3 ........ *.jpg file format
In Picturebox or in Image control, I want to call and replace this images with the name from memory (Look1..... )
I will use it as Custom PrintPreview.
When PrintPreview Windows Closed then How this Temp İmage Files also Delete Automaticly From memory
↧
February 3, 2016, 3:37 am
Is there a simple way for converting the Timer value to hour format. Previously in VB6 I was calculating the time values with the code below. Possibly in vb.net there is a simple way
Thanks in advance
Code:
Dim t As Double
Dim h, b, m, s, ms As Integer
t = Microsoft.VisualBasic.Timer
ms = t - Microsoft.VisualBasic.Int(ms)
t = Int(t)
h = t \ 3600
b = t Mod 3600
m = b \ 60
s = b Mod 60
Console.WriteLine("{0}:{1}:{2}.{3}", h, m, s, ms)
↧
February 3, 2016, 3:40 am
Hi
I have made other posts but now i realize how in detailed they are so i am starting from scratch.
I need to create an 8 character key by generating a number between 33 and 126 and then convert it to its ascii equivalent. For example 67 would be C. Then repeat that 8 times and display the 8 characters to the user.
I have no idea how to do this and in previous posts I have talked about it.
So far this is what I have
Code:
Dim number(9) As Integer
Randomize()
number(0) = Int(Rnd() * 126) + 33 'creates random numbers
number(1) = Int(Rnd() * 126) + 33
number(2) = Int(Rnd() * 126) + 33
number(3) = Int(Rnd() * 126) + 33
number(4) = Int(Rnd() * 126) + 33
number(5) = Int(Rnd() * 126) + 33
number(6) = Int(Rnd() * 126) + 33
number(7) = Int(Rnd() * 126) + 33
number(8) = Int(Rnd() * 126) + 33
number(9) = Int(Rnd() * 126) + 33
For i = 0 To 9
Console.WriteLine(number(i)) 'prints out random numbers 'prints out randomnumbers
Next
ASCnumber(0) = Asc(number(0)) 'i think this converts the random numbers to ascii?
ASCnumber(1) = Asc(number(1))
ASCnumber(2) = Asc(number(2))
ASCnumber(3) = Asc(number(3))
ASCnumber(4) = Asc(number(4))
ASCnumber(5) = Asc(number(5))
ASCnumber(6) = Asc(number(6))
ASCnumber(7) = Asc(number(7))
ASCnumber(8) = Asc(number(8))
ASCnumber(9) = Asc(number(9))
For i = 0 To 9
Console.WriteLine(ASCnumber(i))
Next
Now when I print out the ASCII numbers I do not get the correct conversion shown in the ASCII table. If someone could point out to me where I am going wrong that would be greatly appreciated.
↧
↧
February 3, 2016, 3:46 am
Hi all!
I've been struggling with a minor project, yet it's supposed to be easy. I have a windows form app in vb.net to insert values into a excel file. It used to work in my company cause we had just a "couple" of data to enter. But now we are using txt files to gather the data to insert them in the excel file..
My problem is that we can't use macros anymore because there's always someone that changes something in the code. At this point i have a form that lets u select the txt file and the templated excel ( with sheet1 for data and sheet2 for functions and graphs).
I can already insert the text values into sheet1, yet i have to define a delimiter cause the full row goes to row 1, column A ( for example). The format of data is "1;13:01:24;3,3;OK"
Code:
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim inFile As String() = File.ReadAllLines(TextBox1.Text)
xlWorkBook = xlApp.Workbooks.Open(TextBox2.Text)
xlApp.Visible = True
xlWorkSheet = xlWorkBook.Sheets("sheet1")
For x As Integer = 0 To inFile.Length - 1
xlWorkSheet.Rows(x + 1).Cells(1).value = inFile(x)
Next
End Sub
How can i define de delimiter? and how? I've searched a bit and didn't find a way, cause i cant define "Semicolon:=True " like i've seen before in macros..
Thank you all!
↧
February 3, 2016, 4:21 am
Is it possible to add some finished calculator into a POS system? or can someone guide me how to it? and also why do i need to put Caclulator on POS if i the owner can type on textboxes? my teacher required calculator on our project, sorry im new.
Also how can i make it generic keypad?
↧
February 3, 2016, 5:03 am
Does anyone know of any tools that can be used to highlight, or somehow make blocks of code easier to spot in the code list?
I have an app that's getting rather large, everything is split up into modules as best as it be, and I'm using regions to break code into broadly similar parts. But I'm still trawling through loads of code while testing and debugging. If there was a way to change the background colour of a block of code here and there it would make life so much easier.
Any ideas?
↧
February 3, 2016, 5:07 am
I have an app where pretty much all the code and modules are running in a loop and it's constantly throwing the above exception.
I don't have any errors or warnings in the Error list, I can't see any line of code that could be a problem and my app shows no errors while running.
How can I track down this illusive little bugger?
↧
↧
February 3, 2016, 5:32 am
i just want to protect my vb.net application via HID device so i want when the program starts, detect HID device with specific ID is connected to the computer or not? my HID device is a USB Dongle! i searched a lot and i found a lot of codes but nothing is useful for my case!
↧
February 3, 2016, 8:26 am
Hi everyone, i have a Regex wich i want to load with forbidden words that are inside a text box
when my program loads, basicly it does this:
Code:
For j = 0 To forbiddenwords.Lines.Count - 1
If j >= forbiddenwords.Lines.Count - 1 Then
strRegex = strRegex & forbiddenwords.Lines(j)
Else
strRegex = strRegex & forbiddenwords.Lines(j) & "|"
End If
Next
so, my problem is simple, this takes AGES, the program takes like 3 minutes to load. the forbiddenwords text box contains only about 16k lines and i have no idea how i can speed this up.
any help plesae ?
↧
February 3, 2016, 9:29 am
Can some one send me some sample code or point me in correct direction
I'm currently using this
Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim di As New IO.DirectoryInfo("c:\Users\Noe")
Dim diar1 As IO.FileInfo() = di.GetFiles("*.*", IO.SearchOption.AllDirectories)
Dim dra As IO.FileInfo
'list the names of all files in the specified directory
For Each dra In diar1
ListBox1.Items.Add(dra)
Next
End Sub
End Class
I am getting An unhandled exception of type 'System.UnauthorizedAccessException' occurred in mscorlib.dll
Access Denied can someone help me out.
↧
February 3, 2016, 11:06 am
Hi, i'm trying to get run the example find here:
http://www.activelocksoftware.com/downloads.html
for precision it is the "VB2008 Aletrnate Sample by J. Santamaria"; i load it in vb.net 2010 express edition, and after conversion i tried to run it but i get this error: Unable to load DLL ' AlCrypto3.dll ' : The specified module could not be found . ( Exception from HRESULT : 0x8007007E ). Anyone can help?
↧
↧
February 3, 2016, 11:10 am
I have a textbox that expects a Double amount.
The action is in a button_click()
Code:
Private age As Integer
'get info from screen
age = txtAge.Text
What's the best way to make sure "dog" has not been typed into the age textbox?
I would like to alert the user to enter a numeric value only.
Try/Catch?
↧
February 3, 2016, 11:15 am
Hi,
I need help to detect the blue region in a number plate (country code) for Tesseract OCR reading.
I have tried using AForge, EuclideanColorFiltering and blob detection to detect the blue region.
The blue region is found but it includes all the EU stars and the result is that the OCR reader cant detect the country code properly.
Now using blue color filtering is also not a good solution if a picture is grayscale.
What would be a good way to detect this region for OCR?
Thank you in advance
↧
February 3, 2016, 11:26 am
I have a two-column DataGridView (dgv) that is bound to a DataTable (dtSN) that consists of two columns. The first column is a Boolean and appears in the dgv as a checkbox column. The second column is a String.
I populate the dtSN and then assign it to the dgv's datasource. By default, all the checkboxes are checked. The problem that I'm having is that when I go to uncheck the first checkbox, it won't allow me to uncheck it. I set the dgv's ReadOnly property to False in the designer. All the other checkbox columns will allow me to check/uncheck it except for the very first one. Any idea what could cause that? I've done nothing in code or design that would protect that column. Below is the code that builds the table and then assigns it to the dgv.
Code:
Private Sub LoadSerialNOPanel()
'Debug.Print("LoadSerialNOPanel")
Try
EH.ErrorMessage = String.Empty
dtSN.Rows.Clear()
For x As Integer = 0 To arrSNList.Count - 1
Dim row As DataRow = dtSN.NewRow
row("selected") = Convert.ToBoolean(1)
row("serialNO") = arrSNList(x)
dtSN.Rows.Add(row)
Next
dgvSN.DataSource = Nothing
If dtSN.Rows.Count > 0 Then
dgvSN.DataSource = dtSN
dgvSN.ClearSelection()
End If
Catch ex As Exception
EH.ErrorMessage = "frmCalibration_3/LoadSerialNOPanel() - " & ex.Message & "...Contact Engineering!" & "~E"
End Try
End Sub
↧