|
|
Sorry, mind being a bit more clear?
|
|
|
|
|
More clearer than what? Did you follow the link I gave you and read the article?
Veni, vidi, abiit domum
|
|
|
|
|
Umm, yes? Im still new, I didnt exactly understand everything..
|
|
|
|
|
Suhayb Bashir Yousif wrote: I didnt exactly understand everything. Then maybe you should stop using advanced features. Seriously, you need to understand events, delegates and threading, and the implications of using them before trying to create a project such as you describe. There are many articles and books that will help you. The article I pointed you to also has links to other articles that give more details on these subjects. It is most unlikely that I could give a better explanation than is provided in them.
Veni, vidi, abiit domum
|
|
|
|
|
Suhayb Bashir Yousif wrote: So all the processing happens in the third form while the second form shows a gif saying that the form is loading. You don't need a form to do processing; put it in a separate class or module.
Suhayb Bashir Yousif wrote:
CheckForIllegalCrossThreadCalls = False "No".
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Sounds good, I'll try it
And whats wrong with the CheckForIllegalCrossThreadCalls? I keep getting errors if I dont do that..
|
|
|
|
|
Because touching controls from anything other than the UI thread introduces bugs into your application that are nearly impossible to reproduce, find and fix.
That property is in there to support legacy code should not be used anymore.
|
|
|
|
|
Hi,
I have a vb6 project that has to read the usb port all the time and look at the data to parse it out and put some strings in a file.
The following code will read the usb port and put the data into a circular buffer so that the top level application can read the data and then process it.
This code seems to run 21 times before it just exits.
I do not know what would cause such behavior,
Can anyone offer any suggestions?
Thanks,
Martin
Public Sub WaitForUsbRet()
Dim EventObject As Long
Dim Result As Long
Dim res2 As Integer
Dim Security As SECURITY_ATTRIBUTES
Dim RecBuffer(65) As Byte
Dim rdNum As Long
Dim i As Integer
Dim res3 As Long
res2 = 1
Security.lpSecurityDescriptor = 0
Security.bInheritHandle = CInt(True)
Security.nLength = Len(Security)
EventObject = CreateEvent(Security, CInt(True), CInt(False), "rdUsb")
HIDOverlapped.Offset = 0
HIDOverlapped.OffsetHigh = 0
HIDOverlapped.hEvent = EventObject
Do
Form1.ShpStatus.BackColor = Form1.ShpStatus.BackColor + 1
DoEvents
RecBuffer(4) = 0
RecBuffer(5) = 0
Result = ReadFile _
(HIDHandle, _
RecBuffer(0), _
CLng(Capabilities.InputReportByteLength), _
rdNum, _
HIDOverlapped)
Form1.lstBoxRec.AddItem "Res=" & Result & " rdnum=" & rdNum & " hid=" & HIDOverlapped.Internal
Result = WaitForSingleObject(EventObject, 500)
Form1.lstBoxRec.AddItem "Res2=" & Result & " err=" & GetLastError & " hid=" & HIDOverlapped.Internal
Select Case Result
Case WAIT_TIMEOUT
' Timeout error.
Form1.lstBoxRec.AddItem "Out"
CancelIo (ReadHandle)
Form1.devStatus = RET_USBDEVREVTOOLOW
DoEvents
Case WAIT_FAILED Or WAIT_ABANDONED
Form1.lstBoxRec.AddItem "FAIL"
DoEvents
Case WAIT_OBJECT_0
' ' Success
' ' Use the report data.
rdNum = (RecBuffer(4) + 5)
If rdNum > 65 Then rdNum = 65
If (rdNum > 5) Then
For i = 1 To rdNum
Form1.putInCircBuff (RecBuffer(i))
Next i
End If
Form1.lstBoxRec.ListIndex = Form1.lstBoxRec.ListCount - 1
If (rdNum > 0) Then Form1.tmrCommHndl.Enabled = True
DoEvents
Case Else
Form1.lstBoxRec.AddItem "Else"
CancelIo (ReadHandle)
Form1.devStatus = RET_USBDEVREVTOOLOW
End Select
res3 = ResetEvent(EventObject)
Loop Until res2 = 0
End Sub
|
|
|
|
|
Good morning everyone,
I have a problem with a WinForms vb.net application that i am building. If someone could help me out i would appreciate it.
I have a solution called "MySolution". It has two projects in it. One project is called "Main" and the other project is called "ProjectOne". "Main" contains one form called "frmMain". "ProjectOne" contains two forms ("frmStart" and "frmTest"). The idea is that within the startup project "Main" a user clicks a button (in "frmMain") and it will open up the "frmStart" from "ProjectOne". "frmStart" will have a picturebox in it. The user will then click a button in "frmStart" that will open "frmTest". "frmtest" will have another button that will change the colour of the picturebox in "frmStart" to something like red. My problem is that even though i have all forms opening properly and working
(i have made "ProjectOne" dependent on "Main" and have imported "ProjectOne" and called the "frmMain" as needed. The colour of the picturebox will not change. This application sounds strange because i have just broken the scenario down to a basic program like this to test it out (in reality i am changing datagridviews). If i run the "ProjectOne" on it's own without relying on "Main" to start it, the picturebox colour code will work. However it seems that when i try to combine two projects to work together, the second form that gets opened in the "ProjectOne" project will not make any changes that i need to the first form. I have run debug code on the change colour line and it passes through fine, but it seems to just ignore it completly. Am i missing something very simple here?
Please see attached code below
(Here is code for Main - frmMain)
Imports ProjectOne
Public Class frmMain
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
Dim OpenProjectOne As New ProjectOne.frmMain
OpenProjectOne.Show()
End Sub
End Class
(Here is code for ProjectOne - frmStart)
Public Class frmStart
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
frmTest.Show()
End Sub
End Class
(Here is code for ProjectOne - frmTest)
Public Class frmTest
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
Dim frmMainNew As New ProjectOne.frmMain
frmMain.PictureBox1.BackColor = Color.red
End Sub
End Class
modified 22-Sep-13 20:47pm.
|
|
|
|
|
Did you add a reference to the project or the resulting assembly, or did you only "import" the namespace?
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Quote: second form that gets opened in the "ProjectOne" project will not make any changes that i need to the first form.
Public Class frmTest
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
Dim frmMainNew As New ProjectOne.frmMain
frmMain.PictureBox1.BackColor = Color.red
End Sub
This is because frmTest.Button1_Click is working with its own instance of frmMain. Pass frmTest a reference to the PictureBox like shown below. Or you could also make a Property on frmTest to set the picturebox to work with.
Public Class frmMain
Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
frmTest.Show(Me.PictureBox1)
End Sub
End Class
Public Class frmTest
Private pb As PictureBox
Public Overloads Sub Show(ByVal pict As PictureBox)
Me.pb = pict
Me.Show()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Me.pb.BackColor = Color.Red
End Sub
End Class
|
|
|
|
|
Thankyou TnTinMn,
Your answer put me on the right track on solving my problem.
Thanks again for your assistance.
|
|
|
|
|
I work as a coop student and I need some serious help so I sincerely appreciate everyone's input.
Basically my manager has told me to create an application which takes text files, processes them and creates a report which the user can change tolerances on what columns or fields they want to view. For example, if 10000 files (each file represents company/client audit info) are input into the application for 1 year, the user should be able to filter and compare files from separte months based on column headings in the files such as "% population" and "field".
Background info on why this app needs to be created: 1000s of files containing client audit info is fed into our servers daily. These files contain several columns in regards to client financial info. Someone needs to go through each of these files and just check if there is any irregularities in the data. An example of the irregularities could include info in a column containing number of docs to go from 100 000 docs in 1 year to 10 docs the next.
The problem is that no one has the time to sit down and check irregularities in 1000 files. Thus, it would be great if there was an application which goes through each file, reports any irregularities AND have a good user interface where the auditor can compare stats for files based on filters such as column headings and monthly.
I'm new to database programming so I have the following questions:
1) What language should I use to make this app? We have access to XML, SQL, VB, Visual Studio
2) Any General Tips for making this app?
3) Did anyone do something similar to this before?
4) General logic behind this application?
5) Flowchart help
6) Any link to helpful resources for an app of this context
Please forgive me for asking 6 questions but I need to ask all of them. I've tried my best to be as pin point as I can. I cannot be more specific than this. Every site I go to kicks me off for asking a question which is too general. I need help with every aspect of this post, thanks a ton.
|
|
|
|
|
- VB is the only one of those which is a language, and I trust you meant VB.NET.
- If you need to ask then you are probably going to struggle with this. Sorry, but you need to have at least a general idea if you wish to do it.
- Possibly, and if they have publicised it then Google should find it for you.
- No one is going to provide that for you.
- See 4.
- Google will find you resources for all the different aspects of the application. There are also lots of articles that will help you with sample code, but you have to do the research and the work.
- When you have a specific technical question come back here and people will try to help you.
Veni, vidi, abiit domum
|
|
|
|
|
I have to wonder what your job spec is at the coop, Any manager that asks a random (junior) employee for this needs to be looked at.
The questions you are asking require much more that a forum post, basically you need to be taught to be a developer to deal with this and that is what you are asking for on a forum.
I suggest you tell the manager to hire a contractor to build this or at least get a professional to look at it.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Mycroft Holmes wrote: basically you need to be taught to be a developer to deal with this
Which is at least two years of solid programming, business analysis experience and being mentored.
I agree with the suggestion to get a professional to look at this.
“That which can be asserted without evidence, can be dismissed without evidence.”
― Christopher Hitchens
|
|
|
|
|
Hi I want to establish a ssh connection to remote host and run some set of commands and store its output in text file. I want to do this in vb script. Plz help
|
|
|
|
|
You probably already noticed that you'd either need a COM-object or an executable. I'd recommend using Putty.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Hi Thanks for your reply,
I have achieved it by using plink.
|
|
|
|
|
Thanks i was able to execute commands through plink exe
|
|
|
|
|
I designed a custom attribute using the following class:
<AttributeUsage(AttributeTargets.Field, AllowMultiple:=False, Inherited:=False)> _
Public Class OutputDescriptionAttribute
Inherits Attribute
#Region "Variables"
Private _oldDescription As String
Private _newDescription As String
#End Region
#Region "Properties"
Public ReadOnly Property OldDescription As String
Get
Return Me._oldDescription
End Get
End Property
Public ReadOnly Property NewDescription As String
Get
Return Me._newDescription
End Get
End Property
#End Region
#Region "Constructor"
Public Sub New(oldDescription As String, newDescription As String)
Me._oldDescription = oldDescription
Me._newDescription = newDescription
End Sub
#End Region
End Class
And I apply the attribute to various enumerations. For example:
Public Enum ConditionType
<OutputDescription("I", "Intact")> Intact
<OutputDescription("F", "Fair")> Fair
<OutputDescription("P", "Poor")> Poor
<OutputDescription("N", "None")> None
End Enum
What I haven't be able to figure out exactly, is how to get one of the attribute's properties for a specific enumeration member.
For example, if I have a variable Dim condition As ConditionType = ConditionType.Fair and I want to retrieve either the NewDescription or OldDescription property of the attribute tag ("Fair" or "F" respectively) how can I go about doing this.
Currently I was using the following function to test out methods:
Private Sub GetAttribute(T As Type)
Dim attr As OutputDescriptionAttribute = CType(Attribute.GetCustomAttribute(T, GetType(OutputDescriptionAttribute)), OutputDescriptionAttribute)
Dim newDesc As String = attr.NewDescription
Dim oldDesc As String = attr.OldDescription
End Sub
If I call this method using GetAttribute(GetType(ConditionType)) I get no error message, however if I try doing the following:
Dim condition As ConditionType = ConditionType.Fair
GetAttribute(condition.GetType)
I get any error about ConditionType cannot be converted to a needed type. How can I go about getting the custom attribute that is applied to a specific enumeration member? Thanks in advance.
|
|
|
|
|
I've taken your class and put it in a console-application; below is the code that fetches the member, and then the attributes of said member.
Sub Main()
Dim someCondition As ConditionType = ConditionType.Fair
Dim mi As MemberInfo = GetType(ConditionType).GetMember(someCondition.ToString()).FirstOrDefault()
Dim attribute As OutputDescriptionAttribute = mi.GetCustomAttributes(GetType(OutputDescriptionAttribute)).FirstOrDefault()
Console.WriteLine(attribute.NewDescription)
Console.ReadLine()
End Sub You might want to put this into a nice little helper-method. Generics and method extensions would help in keeping above code readable.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Overlay Text, Image,animation or video on a Runing Video using visual basic 6 and direct x and how i get full screen of of a video.
Shreekanta Mohanty
|
|
|
|
|
There's some problems with your question as it is; first, you're stating requirements, and not asking a specific question on code. We don't give away completed projects.
Also, VB6 has been dead for quite some time now. It's no longer sold, nor supported. If you want "anything" in VB6, then you're basically on your own. You can download VB.NET for free if you need an alternative.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|