|
Hi all,
Can anyone please tell me whats the meaning of below declarations.
Option Strict Off
Option Explicit On
Imports VB = Microsoft.VisualBasic
Imports System.Text
Imports Microsoft.VisualBasic.Strings
|
|
|
|
|
That's what a VB6 programmer would use to continue writing sloppy code in VB.NET.
Option Strict Off
This turns off strict type checking. You should really turn this option on, so that the compiler doesn't do so much implicit conversions.
Option Explicit On
This forces you to declare every variable that you use, which is good.
Imports VB = Microsoft.VisualBasic
This lets you use some VB6 style functions by using a VB. prefix. There are replacements for most of those in the regular framework classes.
Imports System.Text
This is a normal import in a .NET program. It lets you use some text based classes like StringBuilder and Encoding .
Imports Microsoft.VisualBasic.Strings
This lets you use some VB6 style functions like LEFT , MID and INSTR . There are replacements for these in the regular String class.
---
b { font-weight: normal; }
|
|
|
|
|
|
Can anyone give me an example to create form that can search text in Richtextbox?
Thanks
................
|
|
|
|
|
RichTextBox1.Find("string")
|
|
|
|
|
I managed to compile a VB6 program to capture live video through video composite input of TV card.
I use an analog CCD camera using PAL B standard.
It was observed that, once the program starts the capture driver ("WDM video for Windows capture driver Win32")captures the video in NTSC standard. It seems that there is a default setting. Because of that, captured image is not displayed properly.
Can anybody please help me with the coding that I have to add to the program to select/change the video standard from NTSC to PAL?
Dilhara
|
|
|
|
|
You should be able to show the settings dialog, and from there, set if you're capturing PAL or NTSC.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Hello,
In VB6 I can create instance of com server using early binding like this:
Public Srv As Lib.Server
Set Srv = Lib.Server
How to destroy it explicitly? How to call IUnknown::Release(); method explicitly from VB6?
Please help.
Regards,
Leonid
|
|
|
|
|
I think you set Srv to equal nothing, or whatevre you guys call NULL.
Christian Graus - C++ MVP
|
|
|
|
|
Is there a way to prevent a folder from being opened in the system, instead of creating a new user and setting permissions?
Mark Thibodeaux
|
|
|
|
|
You can mark it as hidden or system, but you can't stop it, no.
Christian Graus - C++ MVP
|
|
|
|
|
I am trying to iterate through a dataset as follows:
For Each row As DataRow In ds.Tables("TrxContents").Rows<br />
Me.ListBox1.Items.Add(row("Product"))<br />
Next row
Why is it only using the last row in my table to fillup the listbox? I'm just getting a list of the same (last) record.
Before running this code, the dataset is used to poplate a datagrid. Is it the positioning of the record pointer having just filled the datagrid? If so, how do I reset the record pointer?
|
|
|
|
|
What you have should work correctly. Have you stepped through in the debugger to see what the value of row("Product") is in each iteration?
Mike Lasseter
|
|
|
|
|
Thanks for your reply. No, I haven't stepped through it yet.
I am away from my development PC at the moment, so I can't test it - but if I did as you say, wouldn't it reveal what I'm seeing in my listbox?
|
|
|
|
|
Probably so, but if you see all the values of row("Product") have the same value in the loop this means to me that you have changed the values somewhere before this code executes (or the query from the database was incorrect).
Mike Lasseter
|
|
|
|
|
Thanks for your reply.
I introduced a messagebox - just to see the data before it gets put into the listbox - and it is the same as I'm seeing in the listbox.
The code, from where I put the data into a DataGrid, to where I introduce the For ... Next loop that I'm struggling with is:
Dim ds As New DataSet<br />
ds = New DataSet<br />
<br />
ds.Tables.Add(tblDataTable)<br />
Me.grdDataGrid.SetDataBinding(ds, "TrxContents")<br />
<br />
For Each row As DataRow In ds.Tables("TrxContents").Rows<br />
Me.ListBox1.Items.Add(row("Product"))<br />
Next row
Curiously, it is filling the listbox with the same number of entries as is in my DataTable - even though the data is always from the last row.
I don't want to ...
Me.ListBox1.DisplayMember = "Product"<br />
Me.ListBox1.DataSource = ds.Tables("TrxContents")
... because this will completely fill the listbox with a copy of the datatable, which isn't ultimately what I want to do (I want to apply some conditions to decide what to put in the listbox - I just want to test the syntax at this point).
|
|
|
|
|
hi everyone, i need some help with an assignment i am doing. I need someone to teach me how to make a parent and child form and how to make the two interract with each other, when using variables, structures and assigning objects please explain what is being done when i put all this into a form.. i am using visual basic 6.0 on my schools computers. it is important that you teach me and not just tell me because i must understand what is going on so i can replicate it in the future. Thankyou for your help.
The assignment is fairly straight forward, i am ust putting extra things in to score extra marks, i have to calculate the price of an item from a list box and allocate a currency to perform a conversion rate. I want the parent form to look like the print screens with the images on them and the chold form to use all the variables from the parent form as well as a new set of variables to calculate the total price and allow for another set of items to be bought.. images of my source code are posted as well. at the moment i have made the form stretch to accomodate for buying new items, but it doesnt show in the schools screens due to their resolution. this is why i thought of a prent child form. i have also uploaded my source code in a notepad file. if maybe you could add to it and tell me how i can do this child parent form thing that would be great. Thankyou
Source Code
http://www.uploading.com/files/GA2WMP0U/source_code.txt.html
Form
Source Code
|
|
|
|
|
Tj. wrote: it is important that you teach me and not just tell me because i must understand what is going on so i can replicate it in the future.
You get my 5, just for saying that, instead of just asking for a solution.
Sadly, I can't help you. It's a shame you're learning VB6, VB.NET Express Edition is free, and VB6 is long dead ( that is, it's no longer supported, I admit that some backwards looking companies still use it ).
Christian Graus - C++ MVP
|
|
|
|
|
OK, you took a good post and f'ed it up by posting a ton of links to pictures of your form and code. You also used a site that won't let anyone see the pictures without joining the site. Bad, bad, bad.
All you have to do is post the parts of the code you're having problem with. I know I'm not going to click on 15 different links to see parts of the code in an attempt to diagnose it.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Tj. wrote: i have made the form stretch to accomodate for buying new items, but it doesnt show in the schools screens due to their resolution. this is why i thought of a prent child form.
Instead of using parent/child forms, have you considered using a tab control with two or more tab pages? (I don't work with VB 6.0, so I can't give you specifics)
Roy.
|
|
|
|
|
Hi,
I was wondering if someone could tell me a way to get a match in a string based on wildcards.
For example:
myString = D:\tes folder\tes subfolder\test file.txt
mySearch = fol*te*.tx*
How can I get a match of mySearch in myString?
Thanks
|
|
|
|
|
You can use a Regex object with the pattern "fol.*te.*\.tx.*" to check for a match.
Use ".*" for an equivalent of "*". It matches any charater (".") zero or more times ("*").
Note that the period is written as "\.". It has to be escaped as the period has a special meaning in a pattern. If you put together a pattern from strings that aren't known beforehand, you can use the Regex.Escape method to escape any characters that needs escaping.
---
b { font-weight: normal; }
|
|
|
|
|
And if you're new to RegEx, there's a program called Expresso, which is available via a CP article, or generally on the web, that's very useful to help learn how they work.
Christian Graus - C++ MVP
|
|
|
|
|
Thanks.
Your suggestions are very much appreciated.
Regards,
Zenu
|
|
|
|
|
Hi All,
I need to loop through a listbox and get all the selected items. Everywhere I searched they reccommend:
Dim item as ListItem
for each item in MyListBox
if item.selected
...
end if
next
However, .NET tells me that ListItem is not a defined type.
Thanks for any help
Yoshi
|
|
|
|