|
Hello,
I want to capture data from a Electronic Weighing Scale attached to RS232 and store in a table on some event say click of GET button.
Any help - API or Code or Lead.
Harinder Hunjan
|
|
|
|
|
there maybe a thread asking how to use Sleep method in .Net.
I know how to declare and use Sleep in VB 6.0, but I don't know how to use it in VB.Net
I create a project in VB 6.0 and convert it back to VB.Net and copy and paste the converted code into my VB.Net project but .. I still get error..
Do I need any special header file to import to use Sleep()?
thanks
|
|
|
|
|
Just use System.Threading.Thread.Sleep().
"Blessed are the peacemakers, for they shall be called sons of God." - Jesus
"You must be the change you wish to see in the world." - Mahatma Gandhi
|
|
|
|
|
Thank you I though it only for thread.. not same as Sleep()
|
|
|
|
|
The Sleep() API does the exact same thing - in fact, System.Threading.Thread.Sleep() just calls the Sleep() API.
"Blessed are the peacemakers, for they shall be called sons of God." - Jesus
"You must be the change you wish to see in the world." - Mahatma Gandhi
|
|
|
|
|
I have been trying to uncover a supported way to view pdf files within my windows form in VB.NET, and I am having no luck. Adobe has an unsupported pdf viewer ocx control which is buggy, and all the other controls I"ve seen are way too expensive to be worth it (my other option is to create a hyperlink and pop up the pdf in Adobe viewer as a modal form). Any ideas out there/cheap viewer controls?
|
|
|
|
|
Hello all...
can anyone plz help me/???
how to use the saveas dialog box on visual basic 6.0
thanks alot
Adnan Madi
|
|
|
|
|
Click Project, Components... and add "Microsoft Common Dialog Control 6.0". Add one of these to your form, and it ready to be used. Look here[^] for more info.
Paul
I could put a quote here, but someone would just steal it. Murphy
modified 18-Jul-18 11:59am.
|
|
|
|
|
If I using a checkboxs with a list of items, and one button when clicked the items will show on other form, can you help me to get the source code.
|
|
|
|
|
I am making a VB project for a class I am taking. It involves using databases in Access. My primary key is called "CustID" I am making a project for a company that sells sports cards on online auctions. My first form is a Customer information page. What I need to do is add the "CustID" number that is loaded and have it transfer onto the Order Information page. My instructor mentioned referencing the form, but I wasnt quite sure what he meant. PLEASE HELP ASAP Thanks much
Pat de Wah
|
|
|
|
|
If you have two forms, FA and FB, then you can directly reference FB from FA and Vice versa.
I would suggest implementing method like UpdateCustID(ByVal NewCustID) on FB, which can then be called from FA:
<br />
load FB<br />
<br />
FB.UpdateCustID(NewCustIDFromThisForm)<br />
<br />
FB.Show<br />
<br />
Unload Me<br />
Note that it's not necessary to load FB first - if you reference a form, then it gets loaded implicitly anyway, but I always tend to do so, since makes the code a little clearer
"Now I guess I'll sit back and watch people misinterpret what I just said......"
Christian Graus At The Soapbox
|
|
|
|
|
A common scenario is using controls made in VC++ and incorporated and nested
into a composite control in VB...
For example
FooActiveX-->VB Composite UserControl-->WrapperVB Control--->WindowsForm
In the past, I've read the recommendation is to bubble up events received by
FooActiveX --> WindowsForm.
But have found in practice, that this can be a maintenance nightmare come true.
For example you would have to raise events up in each one in the chain...
FooActiveX--(raise event)-->VB Composite UserControl--(raise event)-->WrapperVB Control---(raise event)-->WindowsForm
and worse is the reverse, when you have to communicate back downward by
calling and bubbling method calls downward
WindowsForm---(DoFooRefresh)-->WrapperVB Control--(DoFooRefresh)-->VB Composite UserControl-- (DoFooRefresh)-->FooActiveX
Is there a sane way to have your cake and eat it too? That is, to maintain
some kind of OO paradigm by making / using nicely encapsulated composite
ActiveX controls of this nature, without this messy chain messaging going
on?
ie....BROADCAST event, where only WindowsForm....will listen in and care
about event and the reverse, BROADCAST a message/command down
so ideally we would end up with these two instead
FooActiveX--(BROADCAST event)-->WindowsForm
WindowsForm---(BROADCAST command DoFooRefresh)-->FooActiveX
|
|
|
|
|
What property controls the initial visible default state of a datagrid?
My application fills a datagrid during form load from a oledb database query.
When the form is loaded the datagrid is blank except for a cell with a + sign
Once the + is clicked then a second cell is shown containing a link. After the link
is clicked the grid then is filled with the data.
How can I programmatically complete the first two clicks so that when the form is loaded
the user sees a full grid of data instead of having to click on the + and then on the link.
Thanks so much
Milancie
|
|
|
|
|
Hi There
What does your code look like, if I use the following the grid immediately shows all the data
(I think it may be from using a DataTable or not?)
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim oDA As SqlClient.SqlDataAdapter
Dim oCon As SqlClient.SqlConnection = New SqlClient.SqlConnection
Dim oTBL As DataTable = New DataTable
oCon.ConnectionString = "Initial Catalog = Northwind;Data Source = (local);uid = sa;pwd=;"
Try
oCon.Open()
Catch ex As Exception
MessageBox.Show(ex.ToString)
End Try
oDA = New SqlClient.SqlDataAdapter("Select * from Customers", "Initial Catalog = Northwind;Data Source = (local);uid = sa;pwd=;")
oDA.Fill(oTBL)
Me.DataGrid1.DataSource = oTBL
End Sub
Regards
Peet Schultz
|
|
|
|
|
Hello
I was able to show (load and show) a form , from inside a picturebox or frame in VB6.
I mean that, I could show a form named F2, inside a frame named fr which was placed on the form named F1.
There is a form named F1, there is a control (frame) placed on the form F1.
And I was able to show the F2 form inside the frame.
How can I do that in VB.NET ?
Thanks...
Best Regards
Emre YAZICI
|
|
|
|
|
Hi Dears
I've to make a plug-in for MS Outlook. This plug-in will take a particular date, and will delete all the attchments of the e-mails which are older than that specific date.
Kindly guide me for the task. Provide/guide me some sample code if possible. I'll be very grateful to you.
Waiting for your kind response.
Atif
Watch Your Thoughts for they will become your actions.
Watch Your Actions for they will become your habits.
Watch Your Habits for they will become your beliefs.
Watch Your Beliefs for they will determine your destiny.
|
|
|
|
|
I have a program on an XP box on a local network. I want to create a shortcut to that program on another machine. I can create the shortcut, but when the program starts, it brings up a debug screen and gives me a massage that says 'Invalid URL'. The debug window shows a NULL URL. I don't know why a URL is being requested, or how to prevent that from happening. I have a second program that I can successfully invoke from the second machine. One difference between the two programs is that the one that does not work references a dll that is part of the vb.net solution.
Any clues would be appreciated.
|
|
|
|
|
How are you sharing the file? Have you put it in a shared directory?
Are the other boxes set up with user accounts on the XP box?
What path do you have in the shortcuts properties?
Can you see the file on the network?
Have you tried registering the DLL on the problem box?
Regards
Wayne Phipps
____________
Time is the greatest teacher... unfortunately, it kills all of its students
LearnVisualStudio.Net
|
|
|
|
|
I have a project that has a RichTextBox that a user can enter data. The text box is called txtOut. I have a CommonDialog control and a command control called cmdSave with this code attached:
Private Sub cmdSave_Click()
Dim sFileName As String
sFileName = txtOut.Text '& theExtension
' Set CancelError is True
CommonDialog1.CancelError = True
On Error GoTo ErrHandler
' Set flags
CommonDialog1.Flags = cdlOFNHideReadOnly
' Set filters
CommonDialog1.Filter = "All Files (*.*)|*.*|Hex Files" & _
"(*.hex)|*.hex|Assembly Files (*.asm)|*.asm"
' Specify default filter
CommonDialog1.FilterIndex = 2
' Display the Open dialog box
CommonDialog1.ShowSave
' Display name of selected file
MsgBox CommonDialog1.FileName
Exit Sub
ErrHandler:
'User pressed the Cancel button
Exit Sub
End Sub
Everything works fine except after I name the file to be saved and hit the save button in the dialog window, it doesn't create the save file. I'm guessing it doesn't see the data in the text box. Can someone give me some help please? Thanks!
|
|
|
|
|
It's because the CommonDialogs only display dialogs to gather information from the user. So the Open, Save and Print dialogs don't actually do the opening, saving or printing for you. You have to implement that yourself. So in your case you have to check that the user has succesfully OKed a filename and then use something like a StreamWriter to save your file.
|
|
|
|
|
I am not an experienced coder, is there sample code or information available on how to do that?
Thanks!
|
|
|
|
|
Here's something I've done in the past, you should be able to pull it apart for your own stuff:
Private Sub SaveINIFile()<br />
Dim strCurrentSection As String<br />
Dim ptrRecord As INILayout<br />
<br />
If strFileName = "" Then Return<br />
<br />
ptrFileWriter = New System.IO.StreamWriter(strFileName)<br />
<br />
For Each strCurrentSection In colINISections<br />
ptrFileWriter.WriteLine("[" & strCurrentSection & "]")<br />
For Each ptrRecord In colINIEntries<br />
If ptrRecord.strSection = strCurrentSection Then<br />
ptrFileWriter.WriteLine(ptrRecord.strHeader & "=" & ptrRecord.strValue)<br />
End If<br />
Next<br />
Next<br />
<br />
ptrFileWriter.Close()<br />
End Sub
|
|
|
|
|
It's quite simple
Open CommonDialog1.FileName For Output As #1
Print #1, "Hello!"
Print #1, "Green is Purple"
Print #1, "--------"
Print #1, Text1.Text
Close #1 HTH
=====
Phlip
Always proofread carefully to see if you any words out
|
|
|
|
|
Thanks to everyone for their help! This is what I ended up using:
Private Sub cmdSave_Click() 'When users clicks Save
'note: the entire file is stored in a string
CommonDialog1.Filter = "Hex files (*.HEX)|*.HEX"
CommonDialog1.ShowSave 'display Save dialog
If CommonDialog1.FileName <> "" Then
Open CommonDialog1.FileName For Output As #1
Print #1, txtOut.Text 'save string to file
Close #1 'close file
End If
End Sub
|
|
|
|
|
I'm trying to get my Data Access classes to provide a Bind method to allow a member variable to be bound to a control, such as a textbox:
Customer.Bind( TextBox1, Customer.m_strUserName )
Inside the Bind method, I'm adding my own eventhandler to the control, and attempting to store the references to the control and the passed member variable into a collection, so this way many controls can be bound against the classes member variables:
Public Sub Bind( ByRef ptrControl as System.Windows.Forms.TextBox, ByRef ptrMember as Object )<br />
<br />
AddHandler ptrControl.KeyPress, AddressOf ConsumeKeyPress<br />
<br />
Dim ptrElement as new ControlCollectionGroup()<br />
ptrElement.ptrControl = ptrControl<br />
ptrElement.ptrMember = ptrMember.Clone()<br />
colControls.Add( ptrElement )<br />
End Sub
Where the type being added into the collection is defined as:
Structure ControlColelctionsGroup<br />
Public ptrElement as System.Windows.Forms.TextBox<br />
Public ptrMember as Object<br />
End Structure
Now the problem is to do with the references being passed for the control and member variable. When they are passed into Bind() as references, they work, and the code can access the original control and variable as you would expect.
After this stage, when the references are passed to an element in a collection, or just stored within normal types within the class - the reference seems to disappear - and I get copies of the textbox and the member object instead. This then renders the whole thing useless as I need to be able to exchange data between the control and the member variable whenever a keypress takes place.
So is there a most learned VB.NETter that can help me with these questions:
1. Can I reference a reference?
2. Is there something similar to StrPtr() I can use which was dropped after VB6.
3. Is there a better way of binding a control to a member variable?
Thanks for reading this novel.
|
|
|
|