Does anyone know how to code yahtzee in vb?
I am having a lot of trouble with the dice. can anyone please help me?Does anyone know how to code Yahtzee in VB?
If you are having trouble getting a random dice number the code is:
Dim i As Short
Randomize()
i = 1 + (Rnd() * 5)Does anyone know how to code Yahtzee in VB?
since the dice has 6 faces, you can create the program by using
RANDOMIZE.
First ';code'; it in English. Then translating it to VB should be easy.
Sunday, November 21, 2010
VB code: Select a row in a datagrid then link to a form?
I'm using an ADO control. I am doing a library system.I have a search button the shows the result in a datagrid. What I want is to select a row from the datagrid then link it to a new form. This new form will also use the values in the row like the FristName, Surname, etc. How would I do this?VB code: Select a row in a datagrid then link to a form?
Code the mouse click event on the datagrid to fire and pass the information to your new form
Excuse the code, it's not well written but it will get you the results you want.
Mouse Code:
Private Sub dg_MouseDoubleClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles dg.MouseDoubleClick
frmNewForm.loadInfo(dg.Rows(dg.
SelectedRows
(0).Index).Cells(';FirstName';), dg.Rows(dg.SelectedRows
(0).Index).Cells(';LastName';))
End Sub
Then on your second form have the relevent method to call
Public sub loadInfo(byref sFirst as string, byref sLast as string)
txtFirstname.text = sFirst
txtLastname.text = sLast
me.show
end sub
Code the mouse click event on the datagrid to fire and pass the information to your new form
Excuse the code, it's not well written but it will get you the results you want.
Mouse Code:
Private Sub dg_MouseDoubleClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles dg.MouseDoubleClick
frmNewForm.loadInfo(dg.Rows(dg.
SelectedRows
(0).Index).Cells(';FirstName';), dg.Rows(dg.SelectedRows
(0).Index).Cells(';LastName';))
End Sub
Then on your second form have the relevent method to call
Public sub loadInfo(byref sFirst as string, byref sLast as string)
txtFirstname.text = sFirst
txtLastname.text = sLast
me.show
end sub
How do you display a number to 2 decimal places in VB 2005?
How would I show the price which is saved in variable (Total2) to 2 decimal places?
Console.Write(';Price: 拢';)
Console.WriteLine(Total2)How do you display a number to 2 decimal places in VB 2005?
Use the Format() command:
Format(Total2, ';$#0.00';) (How did you get the Pound character? I just used the American ';$'; in my example.)
Console.Write(';Price: 拢';)
Console.WriteLine(Total2)How do you display a number to 2 decimal places in VB 2005?
Use the Format() command:
Format(Total2, ';$#0.00';) (How did you get the Pound character? I just used the American ';$'; in my example.)
VB How to read a line from a text file and declare it as a variable?
I have a log in screen and need to be able to read from a a text file and declare the word in the text file as a variable.
So basically ' if txtpassword.text = (The word from text file) then ... login ect..VB How to read a line from a text file and declare it as a variable?
are you sure you want the password to be coming from a text file? The text file has it in plain text.. are you really sure?
So basically ' if txtpassword.text = (The word from text file) then ... login ect..VB How to read a line from a text file and declare it as a variable?
are you sure you want the password to be coming from a text file? The text file has it in plain text.. are you really sure?
How to connect to the webcan in VB?
I wanna make an application in VB that uses the webcam to record some videos, do u have any idea how to do this ??? or any components that helps in this ?? i have few that are about 700 $ ,, i wanna something cheaper :( thx How to connect to the webcan in VB?
It's not easy in VB, that's why the components are expensive. If you could do it with a few lines of code (or even a few hundred) they'd be cheaper.
It's not easy in VB, that's why the components are expensive. If you could do it with a few lines of code (or even a few hundred) they'd be cheaper.
Some files are out of date Message arrising when i installing VB Application How to Sole it?
Look for free updates online.... Also try the compatibilty wizard if you have it. Also, try contacting the company about the problem.
How to add our own designed Windows Controls to the VB .net solution. This is not a web application.?
I have designed a button(*.giff). I want to add it my solution.Please Help.How to add our own designed Windows Controls to the VB .net solution. This is not a web application.?
Hi!
The button that you've designed is an image, not a windows forms control. You can add it to a PictureBox control, however, to achieve your desired effect:
1. Drag and drop a PictureBox control onto your form.
2. Resize the PictureBox to the size of your button.
3. Click on the PictureBox and view it's properties in the properties window.
4. Click in the ';Image'; property and then on the ';...'; button.
5. Select the ';Project Resources File'; option and then click ';Import';.
6. Navigate to your image in the window that appears.
7. Click ';OK';.
Now your button should be on your form, inside a PictureBox control. Feel free to e-mail me if you need any more help!
I hope this helps!How to add our own designed Windows Controls to the VB .net solution. This is not a web application.?
A gif isn't a control, it's a picture. You'll need a control to put it in. (Designing your own control means writing code.)
Hi!
The button that you've designed is an image, not a windows forms control. You can add it to a PictureBox control, however, to achieve your desired effect:
1. Drag and drop a PictureBox control onto your form.
2. Resize the PictureBox to the size of your button.
3. Click on the PictureBox and view it's properties in the properties window.
4. Click in the ';Image'; property and then on the ';...'; button.
5. Select the ';Project Resources File'; option and then click ';Import';.
6. Navigate to your image in the window that appears.
7. Click ';OK';.
Now your button should be on your form, inside a PictureBox control. Feel free to e-mail me if you need any more help!
I hope this helps!How to add our own designed Windows Controls to the VB .net solution. This is not a web application.?
A gif isn't a control, it's a picture. You'll need a control to put it in. (Designing your own control means writing code.)
If I have an excel file open how can I write a VB program to tell me if the file is open ready only or write?
If I have an excel file open how can I write a VB program to tell me if the file is open ready only or write?If I have an excel file open how can I write a VB program to tell me if the file is open ready only or write?
This macro will display a message box advising whether the active workbook was opened 'Read Only' or not.
Copy this macro to the clipboard:
Sub Chk_Status()
If ActiveWorkbook.ReadOnly = True Then
MsgBox ';This workbook was opened 'Read Only'';
Else
MsgBox ';This workbook was not opened 'Read Only'';
End If
End Sub
Press ALT + F11
In the menus at the top of the VBE, select INSERT %26gt; MODULE
Paste the macro into the editing area to the right.
Close the VBE and return to Excel.
Press ALT + F8
When the Macros window opens, highlight the macro and click 'Options..'.
Enter a letter to use as a keyboard shortcut and click 'Ok'.
Close the Macros window and return to Excel.
Press CTRL + your letter to run the macro.favorite musical groups
This macro will display a message box advising whether the active workbook was opened 'Read Only' or not.
Copy this macro to the clipboard:
Sub Chk_Status()
If ActiveWorkbook.ReadOnly = True Then
MsgBox ';This workbook was opened 'Read Only'';
Else
MsgBox ';This workbook was not opened 'Read Only'';
End If
End Sub
Press ALT + F11
In the menus at the top of the VBE, select INSERT %26gt; MODULE
Paste the macro into the editing area to the right.
Close the VBE and return to Excel.
Press ALT + F8
When the Macros window opens, highlight the macro and click 'Options..'.
Enter a letter to use as a keyboard shortcut and click 'Ok'.
Close the Macros window and return to Excel.
Press CTRL + your letter to run the macro.
If I have an excel file open how can I write a VB program to tell me if the file is open ready only or write?
If I have an excel file open how can I write a VB program to tell me if the file is open ready only or write?If I have an excel file open how can I write a VB program to tell me if the file is open ready only or write?
Opening it for append might fail if it's open for write. Try it. Then trap the error.
Opening it for append might fail if it's open for write. Try it. Then trap the error.
Is it possible to print from VB to a printer not installed?
Lets suppose that my computer has 3 printer installed, but I do not want to print to any of them, I want to print to a new one, but I do not want to install that printer in my computer, is that possible to print from a VB program to that specific non installed printer in my computer. If so, do you know how to do it ?
Thank youIs it possible to print from VB to a printer not installed?
i'm skeptical this would work but you could try directing output, something like:
type %26lt;file.txt%26gt; %26gt; \\%26lt;servername%26gt;\%26lt;printername%26gt;Is it possible to print from VB to a printer not installed?
err no and I don't think you can in VB - VB will only operate within the windows environment you can't write at device level in vb (like you can in other languages like C++)
You can install a non existant printer in the same way as pdf creators do
Thank youIs it possible to print from VB to a printer not installed?
i'm skeptical this would work but you could try directing output, something like:
type %26lt;file.txt%26gt; %26gt; \\%26lt;servername%26gt;\%26lt;printername%26gt;Is it possible to print from VB to a printer not installed?
err no and I don't think you can in VB - VB will only operate within the windows environment you can't write at device level in vb (like you can in other languages like C++)
You can install a non existant printer in the same way as pdf creators do
After creating database program in vb using MS access how to make it independent of MS access?
I have creted a setup of a database program in vb using MS access, but when i run the installed program where the ms access in not installed it does not work. I want to know how is it created.After creating database program in vb using MS access how to make it independent of MS access?
An MS Access DB isn't the same as a VB .EXE file.
MS Access uses a specialized version of VB known as VBA. It's different enough it's recognized as it's own language (as is VBE (Visual Basic Excel).
You can get a program called ';Access Runtime'; from Micorsoft that will allow an Access DB to run without having MS Access installed, but It's not actually a conversion to VB. And Microsoft also offers an program that CONVERTS an MS Access DB to an SQL-Server DB program so upgrades are easier.
I don't know if there is an actual converter for VBA code to VB code. If you did convert it you would STILL need to have the VB Developer files and Runtime environment installed before it would run.
Try looking up the ';Access Runtime'; program download at Microsoft's support site.After creating database program in vb using MS access how to make it independent of MS access?
www.howtogeek.com expertIT browse
An MS Access DB isn't the same as a VB .EXE file.
MS Access uses a specialized version of VB known as VBA. It's different enough it's recognized as it's own language (as is VBE (Visual Basic Excel).
You can get a program called ';Access Runtime'; from Micorsoft that will allow an Access DB to run without having MS Access installed, but It's not actually a conversion to VB. And Microsoft also offers an program that CONVERTS an MS Access DB to an SQL-Server DB program so upgrades are easier.
I don't know if there is an actual converter for VBA code to VB code. If you did convert it you would STILL need to have the VB Developer files and Runtime environment installed before it would run.
Try looking up the ';Access Runtime'; program download at Microsoft's support site.After creating database program in vb using MS access how to make it independent of MS access?
www.howtogeek.com expertIT browse
How do correct a exception sqlceme35.dll in VB Express?
I am building a database using VB 2008 Express using the database found in the download. When I try to call for info from the database I get the above exception thrown. I have followed the scenarios as presented in the ms-help for building and accessing databases in VB. How do I correct the error?How do correct a exception sqlceme35.dll in VB Express?
What operating system? What is the exact error message?
This: ';The specified module could not be found. (Exception from HRESULT: 0x8007007E'; - just Google it
What operating system? What is the exact error message?
This: ';The specified module could not be found. (Exception from HRESULT: 0x8007007E'; - just Google it
How to link VB with Access Database file?
i m create a project but i have no idea of how to link with ms access database.How to link VB with Access Database file?
have a look at these official microsoft documentation and tutorial pages for VB6:
http://msdn.microsoft.com/en-us/vbrun/ms鈥?/a>
It also has sample code/applications including database code.
If you don't have to create the database using code then it may be better to design it using microsoft access first.
Have a look at that lot and if you get really stuck then you can use the Yahoo Answers mail (see my profile page) to email me and I'll see what I can do.
have a look at these official microsoft documentation and tutorial pages for VB6:
http://msdn.microsoft.com/en-us/vbrun/ms鈥?/a>
It also has sample code/applications including database code.
If you don't have to create the database using code then it may be better to design it using microsoft access first.
Have a look at that lot and if you get really stuck then you can use the Yahoo Answers mail (see my profile page) to email me and I'll see what I can do.
How can I make task shower in VB 2008?
How can I make a task shower that only shows the only opened tasks, not the processes, but the opened tasks, although, a process shower would be nice to, please respond soon?
Thanks in advanceHow can I make task shower in VB 2008?
Dim procList() As Process = Process.GetProcesses()
Dim quantity As Integer = 0
Dim i As Integer
Dim processinfo As String = ';Processes Running: ';
For Each Process In procList
quantity = quantity + 1
Next
For i = 0 To quantity - 1 Step i + 1
Dim strProcName As String = procList(i).ProcessName
Dim iProcID As Integer = procList(i).Id
processinfo = processinfo %26amp; vbNewLine %26amp; procList(i).ProcessName
Next
Textbox1.text = processinfo
Double click on a button, and insert the above code in it. Also, make a textbox1 (multiline, and read only)
Thanks in advanceHow can I make task shower in VB 2008?
Dim procList() As Process = Process.GetProcesses()
Dim quantity As Integer = 0
Dim i As Integer
Dim processinfo As String = ';Processes Running: ';
For Each Process In procList
quantity = quantity + 1
Next
For i = 0 To quantity - 1 Step i + 1
Dim strProcName As String = procList(i).ProcessName
Dim iProcID As Integer = procList(i).Id
processinfo = processinfo %26amp; vbNewLine %26amp; procList(i).ProcessName
Next
Textbox1.text = processinfo
Double click on a button, and insert the above code in it. Also, make a textbox1 (multiline, and read only)
How do I update MySQL database using VB 2005?
The database works as to connection and navigation. I used DataSet, DataTable, DataAdapter, and CurrencyManager. I display data using textboxes which are NOT binded by:
TextBox.Text = DataTable.DefaultView(Cur
rencyManager.Position).It
em(';Column1';).ToString
To add record, I clear the textboxes, put data into them and click a save button which does:
CurrencyManager.AddNew()
DataTable.DefaultView(Cur
rencyManager.Position).It
em(';Column1';) = TextBox.Text
CurrencyManager.EndCurren
tEdit()
Everything works fine and I can navigate through each record plus the new record in the program. The problem is when I close the program and open it again, the changes were not saved to the MySQL database.
Does anyone know why? And how will I go about updating MySQL database?How do I update MySQL database using VB 2005?
Try
DataAdapter.Update(DataTable)
TextBox.Text = DataTable.DefaultView(Cur
rencyManager.Position).It
em(';Column1';).ToString
To add record, I clear the textboxes, put data into them and click a save button which does:
CurrencyManager.AddNew()
DataTable.DefaultView(Cur
rencyManager.Position).It
em(';Column1';) = TextBox.Text
CurrencyManager.EndCurren
tEdit()
Everything works fine and I can navigate through each record plus the new record in the program. The problem is when I close the program and open it again, the changes were not saved to the MySQL database.
Does anyone know why? And how will I go about updating MySQL database?How do I update MySQL database using VB 2005?
Try
DataAdapter.Update(DataTable)
How to let my friends use my VB 2008 app?
Today I have finished my application and save it, I then sent him the simple file which was in the bin folder (of the program folder) but that didn't work so I sen him the published version, these results did not work either... How would I make an application work on my friends computer and could you explain step by step on how to do this :)
Thanks
PatrickMSHow to let my friends use my VB 2008 app?
They're probably missing the .NET framework. They'll need to install it on their computer to run .NET programs. Which framework version did you code for? 2.0, 3.0, or 3.5?How to let my friends use my VB 2008 app?
PUt the file on a disk or USB and do the same thing on his computer
Thanks
PatrickMSHow to let my friends use my VB 2008 app?
They're probably missing the .NET framework. They'll need to install it on their computer to run .NET programs. Which framework version did you code for? 2.0, 3.0, or 3.5?How to let my friends use my VB 2008 app?
PUt the file on a disk or USB and do the same thing on his computer
How to search in vb 6.0 and having mysql as backend?
I want to know how to search in vb 6.0, my backend is mysql and I connect thru ADODC controlsHow to search in vb 6.0 and having mysql as backend?
I totally agree with you
I totally agree with you
I would like to know how the system stores the info of your mouseclick and how to call it in VB.NET?
I want to record every click my mouse does into an integer, like i can call a ';form1.click'; event and increment it into a variable eg, count +=1. but this only works if i click in the form, i want the program to run in the background and record all clicks done while the computer is on, and not just the clicks i do on the form.I would like to know how the system stores the info of your mouseclick and how to call it in VB.NET?
You need to hook into system events to capture those. Read up on Platform Invoke (consuming Win32 API functions in .NET) and then read up on SetWindowsHookEx.
Here are a couple of links to show you how to code this up.
http://www.eggheadcafe.com/conversation.鈥?/a>
http://www.codeproject.com/KB/system/glo鈥?/a>married advice for
You need to hook into system events to capture those. Read up on Platform Invoke (consuming Win32 API functions in .NET) and then read up on SetWindowsHookEx.
Here are a couple of links to show you how to code this up.
http://www.eggheadcafe.com/conversation.鈥?/a>
http://www.codeproject.com/KB/system/glo鈥?/a>
I would like to know how the system stores the info of your mouseclick and how to call it in VB.NET?
I want to record every click my mouse does into an integer, like i can call a ';form1.click'; event and increment it into a variable eg, count +=1. but this only works if i click in the form, i want the program to run in the background and record all clicks done while the computer is on, and not just the clicks i do on the form.I would like to know how the system stores the info of your mouseclick and how to call it in VB.NET?
You need to hook into system events to capture those. Read up on Platform Invoke (consuming Win32 API functions in .NET) and then read up on SetWindowsHookEx.
Here are a couple of links to show you how to code this up.
http://www.eggheadcafe.com/conversation.鈥?/a>
http://www.codeproject.com/KB/system/glo鈥?/a>
You need to hook into system events to capture those. Read up on Platform Invoke (consuming Win32 API functions in .NET) and then read up on SetWindowsHookEx.
Here are a couple of links to show you how to code this up.
http://www.eggheadcafe.com/conversation.鈥?/a>
http://www.codeproject.com/KB/system/glo鈥?/a>
How can I add a variable based on the string that a user inputs in VB.Net?
What I am trying to do in VB.Net is ask the users a couple of questions. I want to create a variable based on their answers. So if a user inputs the word homework, then I want to create a variable name homework. Seems to be an easy task but I can't figure it out. Any ideas or help will be appreciated. Thanks!!How can I add a variable based on the string that a user inputs in VB.Net?
I do not think you can create a new variable during runtime, sorry.
Dane
I do not think you can create a new variable during runtime, sorry.
Dane
How to get the sum of 2 cells into another cell using VB?
I hvae a proram that has this:
ActiveCell.FormulaR1C1 = (I want it to put in the Sum(A1 + C1)
HELP!!!How to get the sum of 2 cells into another cell using VB?
http://support.microsoft.com/kb/148317
ActiveCell.FormulaR1C1 = (I want it to put in the Sum(A1 + C1)
HELP!!!How to get the sum of 2 cells into another cell using VB?
http://support.microsoft.com/kb/148317
How to delete a file from the system and clear the registry using vb.net code?
I need to delete a file and delete all its existence in the system including the details in the registry. Please send me the source code or the place i will get the code in VB.Net.How to delete a file from the system and clear the registry using vb.net code?
http://msdn2.microsoft.com/en-us/library鈥?/a>
http://msdn2.microsoft.com/en-us/library鈥?/a>How to delete a file from the system and clear the registry using vb.net code?
see http://www.pscode.com for lots of .net tutorials
http://msdn2.microsoft.com/en-us/library鈥?/a>
http://msdn2.microsoft.com/en-us/library鈥?/a>How to delete a file from the system and clear the registry using vb.net code?
see http://www.pscode.com for lots of .net tutorials
In vb how can I set a var from a text file on the internet?
In visual basic how can I set a variable from a text file that is on my website. EG:
My website is example.com
I have a text file at http://example.com/textfile.txt
I need to know how to make vb go to that url, get the contents of the text file (it will just be a 3 digit number less than 255) then store it in a variable.In vb how can I set a var from a text file on the internet?
You would need to use the System.Net.HttpWebRequest namespace to get this done. Example below:
'Add these lines to the top of your code page
Imports System.Net
Imports System.IO
Function GetFileContents() as String
Dim results as string
Dim url as string = ';http://example.com/textfile.text';
Dim webresponse as HttpWebResponse = HttpWebRequest.Create(url).GetResponse()
Dim reader as streamreader = New Streamreader(webresponse.GetResponseStre鈥?br>
Dim str as string = reader.readline()
Do while not str is nothing
results = str
str = reader.readline()
Loop
return results
end function
You can either return the number from the text file as string (as indicated above) and convert it to an integer if needed back in the main part of your code. You could also change this function to return an integer and convert the results variable to an Integer before returning it.
Hope this helps.
If you need further clarification, you can e-mail me.
My website is example.com
I have a text file at http://example.com/textfile.txt
I need to know how to make vb go to that url, get the contents of the text file (it will just be a 3 digit number less than 255) then store it in a variable.In vb how can I set a var from a text file on the internet?
You would need to use the System.Net.HttpWebRequest namespace to get this done. Example below:
'Add these lines to the top of your code page
Imports System.Net
Imports System.IO
Function GetFileContents() as String
Dim results as string
Dim url as string = ';http://example.com/textfile.text';
Dim webresponse as HttpWebResponse = HttpWebRequest.Create(url).GetResponse()
Dim reader as streamreader = New Streamreader(webresponse.GetResponseStre鈥?br>
Dim str as string = reader.readline()
Do while not str is nothing
results = str
str = reader.readline()
Loop
return results
end function
You can either return the number from the text file as string (as indicated above) and convert it to an integer if needed back in the main part of your code. You could also change this function to return an integer and convert the results variable to an Integer before returning it.
Hope this helps.
If you need further clarification, you can e-mail me.
How do I connect to a MySQL database with Microsoft VB.NET?
Hi There,
I have created numerous applications linking SQL Server 2003 to Visual Studio.NET successfully and now I am creating a new one that requires use of MySQL. I am continuously getting the error that the database does not exist.
Please can someone assist me with some sample code or link to where I can get answers.
Thank You.How do I connect to a MySQL database with Microsoft VB.NET?
It's very much doable. Refer to the following link for step-by-step guidance -
I have created numerous applications linking SQL Server 2003 to Visual Studio.NET successfully and now I am creating a new one that requires use of MySQL. I am continuously getting the error that the database does not exist.
Please can someone assist me with some sample code or link to where I can get answers.
Thank You.How do I connect to a MySQL database with Microsoft VB.NET?
It's very much doable. Refer to the following link for step-by-step guidance -
How can I install VB 2008 onto a memory stick?
Ive downloaded it onto a memory stick and want to install it on to a memory stick...How can I install VB 2008 onto a memory stick?
If u install on a usb stick u can still use it from the pc in which the stick was present during install.
I think u mean u need a portable version.
The link provides one with some help as well.
http://portableapps.com/node/190
If u install on a usb stick u can still use it from the pc in which the stick was present during install.
I think u mean u need a portable version.
The link provides one with some help as well.
http://portableapps.com/node/190
How to check every 8th character in a String using VB?
How would I program using Visual Basic for a loop to go through and check whether every 8th character (8, 16, 24, etc) and see whether or not it is a 1 or 0?How to check every 8th character in a String using VB?
dim i as integer
for i =0 to len(string) step 8
dim char as string
char = mid(i,i+8,sting)
nextHow to check every 8th character in a String using VB?
actually.....
dim i as integer
for i =0 to len(string) step 8
dim char as string
char = mid(i,i,string) 'i+8 would have given u 8 chars from that 8th char
next
put the string into a char array
dim i as integer
for i =0 to len(string) step 8
dim char as string
char = mid(i,i+8,sting)
nextHow to check every 8th character in a String using VB?
actually.....
dim i as integer
for i =0 to len(string) step 8
dim char as string
char = mid(i,i,string) 'i+8 would have given u 8 chars from that 8th char
next
Report Abuse
put the string into a char array
ASAP How do i open a word document in VB 2008 express edition?
Hi
I'm using VB 2008 express edition
i want to have a button on my VB application so when i click it a certain word document will open.
I hope that makes sense
if you can... can you have a button that when u press it a file is downloaded?
Can someone please supply the code that will work on vb2008
cheers tomASAP How do i open a word document in VB 2008 express edition?
VB Tutorials-http://vbtutorial.info/
I'm using VB 2008 express edition
i want to have a button on my VB application so when i click it a certain word document will open.
I hope that makes sense
if you can... can you have a button that when u press it a file is downloaded?
Can someone please supply the code that will work on vb2008
cheers tomASAP How do i open a word document in VB 2008 express edition?
VB Tutorials-http://vbtutorial.info/
How do I create controls on the fly in VB 2005?
I need to make a panel with some checkboxes and buttons.
I have an identical one made with the forms designer that is visible on load, is there a way to clone that one?How do I create controls on the fly in VB 2005?
you've written 2 different questions:
1) How to create controls on the fly
For example:
Dim myCtrl as New Windows.Forms.CheckBox
myCtrl.Checked = True
myCtrl.Visible = True
myForm.Controls.Add (myCtrl)
Done! You've added a check box control to a form.
2) I don't get the second one. I think you should create a new instance of the graphically designed form...could you be a little more specific?
Good LuckHow do I create controls on the fly in VB 2005?
Hey, your answer helped my program out a lot. I was working with a Panel control, and without the myForm.Controls.Add(myCtrl) was missing. WIthout it, I would have been lost. Thanksused home bars for
I have an identical one made with the forms designer that is visible on load, is there a way to clone that one?How do I create controls on the fly in VB 2005?
you've written 2 different questions:
1) How to create controls on the fly
For example:
Dim myCtrl as New Windows.Forms.CheckBox
myCtrl.Checked = True
myCtrl.Visible = True
myForm.Controls.Add (myCtrl)
Done! You've added a check box control to a form.
2) I don't get the second one. I think you should create a new instance of the graphically designed form...could you be a little more specific?
Good LuckHow do I create controls on the fly in VB 2005?
Hey, your answer helped my program out a lot. I was working with a Panel control, and without the myForm.Controls.Add(myCtrl) was missing. WIthout it, I would have been lost. Thanks
Report Abuse
How do I enable my VB Script in Windows Vista? I want to download ITunes and It want let me because of this?
I have a brand new Laptop computer with Windows Vista and I can't understand why I can't download Itunes. It keeps telling me that I either need to have VB script or I need to enable it. How do I do that?How do I enable my VB Script in Windows Vista? I want to download ITunes and It want let me because of this?
iTunes is currently not compatible with Windows Vista. Apple computers has released a statement requesting that iTunes users not upgrade to Vista yet.
That said, just use something else. Winamp, Windows Media Player, and Real Player are all perfectly capable of sycronizing with your iPod.How do I enable my VB Script in Windows Vista? I want to download ITunes and It want let me because of this?
I just figured out how to fix this problem on Windows Vista. Go to start-%26gt;All Programs-%26gt;Accesories-%26gt; then rightclick on the command promp, and run as an Administrator . Then go to the Windows/system32 path. after that type in ';regsvrs32 vbscript.dll'; With out quotes.
Hope is helps
iTunes is currently not compatible with Windows Vista. Apple computers has released a statement requesting that iTunes users not upgrade to Vista yet.
That said, just use something else. Winamp, Windows Media Player, and Real Player are all perfectly capable of sycronizing with your iPod.How do I enable my VB Script in Windows Vista? I want to download ITunes and It want let me because of this?
I just figured out how to fix this problem on Windows Vista. Go to start-%26gt;All Programs-%26gt;Accesories-%26gt; then rightclick on the command promp, and run as an Administrator . Then go to the Windows/system32 path. after that type in ';regsvrs32 vbscript.dll'; With out quotes.
Hope is helps
Report Abuse
How to get vb 6.0 and install related software?
i am doing bca project ,i have to do new project with vb 6.0 base, so i need vb 6.0 softwareHow to get vb 6.0 and install related software?
here see if this helps http://download.cnet.com/1770-20_4-0.htm鈥?/a>
here see if this helps http://download.cnet.com/1770-20_4-0.htm鈥?/a>
How to establish connection between VB & SQL Server?
Please tell me how to connect to SQL Server from a VB Application. How to establish connection between VB %26amp; SQL Server?
This is in VB 6. To do it in VB.Net, run it through the code converter.
Replace ';MyServer';, ';MyDatabase';, ';MyUserName';, ';MyPassword';, ';MyTable'; as appropriate:
Dim sConn as String
Dim rs1 as New ADODB.Recordset
Dim cn1 as New ADODB.Connection
' Connection string
' Replace Uid=... onwards with Trusted_Connection=Yes to use Windows security rather than SQL Server
sConn = ';Driver={SQL Server};Server=MyServer;Database=MyDatab鈥?br>
' Open the connection
cn1.Open sConn
' Let's grab something from a table...
rs1.Open ';SELECT * FROM MyTable';, cn1
rs1.CloseHow to establish connection between VB %26amp; SQL Server?
tought to eplain on Y! A!
I think you miss spelled. You mean how to use skillet on BBQ grill.
Start your server and ensure the SQL service is running. On the clients VB Input the IP of the server and also any connection credentials you may need... (you set up the server so i guess you already know these) click connect and away you go. I have had problems like ';TCP connection issue... '; blah blah blah... long and short of it, the firewall needs to allow incoming and outgoing actions. Google is the best place to start for these issues in the future...
This is in VB 6. To do it in VB.Net, run it through the code converter.
Replace ';MyServer';, ';MyDatabase';, ';MyUserName';, ';MyPassword';, ';MyTable'; as appropriate:
Dim sConn as String
Dim rs1 as New ADODB.Recordset
Dim cn1 as New ADODB.Connection
' Connection string
' Replace Uid=... onwards with Trusted_Connection=Yes to use Windows security rather than SQL Server
sConn = ';Driver={SQL Server};Server=MyServer;Database=MyDatab鈥?br>
' Open the connection
cn1.Open sConn
' Let's grab something from a table...
rs1.Open ';SELECT * FROM MyTable';, cn1
rs1.CloseHow to establish connection between VB %26amp; SQL Server?
tought to eplain on Y! A!
I think you miss spelled. You mean how to use skillet on BBQ grill.
Start your server and ensure the SQL service is running. On the clients VB Input the IP of the server and also any connection credentials you may need... (you set up the server so i guess you already know these) click connect and away you go. I have had problems like ';TCP connection issue... '; blah blah blah... long and short of it, the firewall needs to allow incoming and outgoing actions. Google is the best place to start for these issues in the future...
Does anyone have experience with Excel macros in vb?
I need to test values in a loop. The Excel spreadsheet part is throwing me off. I also need to know how to add columns from the code. Is that even possible?Does anyone have experience with Excel macros in vb?
Looping through a range of cells...
For Each cell in Range(';A1:A100';)
'Your code here e.g.
'x = Cell.value * 100
Next cell
Insert a column...
Range(';B1';).EntireColumn.Insert
'or
ActiveCell.EntireColumn.Insert
Looping through a range of cells...
For Each cell in Range(';A1:A100';)
'Your code here e.g.
'x = Cell.value * 100
Next cell
Insert a column...
Range(';B1';).EntireColumn.Insert
'or
ActiveCell.EntireColumn.Insert
Need : VB Code to count how many times words are used in a text file?
And also how many words are in the file. Please help!Need : VB Code to count how many times words are used in a text file?
Imports System.IO
'Find How many times a word is used in a text file
Private Function FindWordOccourance(ByVal fileName As String, ByVal stringToFined As String) as Integer
Dim str() As String = File.ReadAllLines(fileName)
Dim I as Integer = 0
Using sw As New IO.StreamWriter(fileName)
For Each Line As String In str
If (Line.Contains(strToFined)) Then
I = I + 1
End If
Next
End Using
Return I
End Sub
'Find how many words in a text file
Private Function CountWords(ByVal fileName As String) as Integer
Dim str() As String = File.ReadAllLines(fileName)
Dim Words() as string = str.Split('; ';)
Return Words.Length
End Sub
Imports System.IO
'Find How many times a word is used in a text file
Private Function FindWordOccourance(ByVal fileName As String, ByVal stringToFined As String) as Integer
Dim str() As String = File.ReadAllLines(fileName)
Dim I as Integer = 0
Using sw As New IO.StreamWriter(fileName)
For Each Line As String In str
If (Line.Contains(strToFined)) Then
I = I + 1
End If
Next
End Using
Return I
End Sub
'Find how many words in a text file
Private Function CountWords(ByVal fileName As String) as Integer
Dim str() As String = File.ReadAllLines(fileName)
Dim Words() as string = str.Split('; ';)
Return Words.Length
End Sub
How do I make my program OS specific in vb.net?
Having some program trouble in vb.net.
Can someone give me a code example, like an if statement so that if the Os is windows XP then I run one line, but if its windows vista I run a different line. I tried google but to no success.
Thanks in advance!How do I make my program OS specific in vb.net?
You would need to use ';GetVersionEx'; from kernel32.dll. I'm not a VB fan, I use C++ and C# for all my application development needs. But I got that information from the MSDN web site. The VB.NET syntax is as follows (and it's at the bottom of the MSDN link I provided):
%26lt;DllImport(';kernel32.dll';, CharSet:=CharSet.Auto, SetLastError:=True)%26gt; _
Public Shared Function GetVersionEx(%26lt;[In], Out%26gt; ByVal ver As OSVERSIONINFO) As Boolean
End Function
Here's the descriptive link:
http://msdn.microsoft.com/en-us/library/鈥?/a>How do I make my program OS specific in vb.net?
System.Environment.OSVersion
http://msdn.microsoft.com/en-us/library/鈥?/a>
I found code to check for vista in C#.
VB.net : something like
Dim blnXP As Boolean = False
Dim blnVista As Boolean = False
Dim osInfo As System.Version = System.Environment.OSVersion.Version
Select Case osInfo.Major
Case Is = 6
blnVista = True
Case Is = 5
If osInfo.Minor %26gt; 1 Then
blnXP = True
End If
End Select
Can someone give me a code example, like an if statement so that if the Os is windows XP then I run one line, but if its windows vista I run a different line. I tried google but to no success.
Thanks in advance!How do I make my program OS specific in vb.net?
You would need to use ';GetVersionEx'; from kernel32.dll. I'm not a VB fan, I use C++ and C# for all my application development needs. But I got that information from the MSDN web site. The VB.NET syntax is as follows (and it's at the bottom of the MSDN link I provided):
%26lt;DllImport(';kernel32.dll';, CharSet:=CharSet.Auto, SetLastError:=True)%26gt; _
Public Shared Function GetVersionEx(%26lt;[In], Out%26gt; ByVal ver As OSVERSIONINFO) As Boolean
End Function
Here's the descriptive link:
http://msdn.microsoft.com/en-us/library/鈥?/a>How do I make my program OS specific in vb.net?
System.Environment.OSVersion
http://msdn.microsoft.com/en-us/library/鈥?/a>
I found code to check for vista in C#.
VB.net : something like
Dim blnXP As Boolean = False
Dim blnVista As Boolean = False
Dim osInfo As System.Version = System.Environment.OSVersion.Version
Select Case osInfo.Major
Case Is = 6
blnVista = True
Case Is = 5
If osInfo.Minor %26gt; 1 Then
blnXP = True
End If
End Select
How to put Text into a VB Program?
I am making a program that needs to display text that is not editable by the user and can have about a paragraph in it.
I tried using a label but it wouldn't let me put it into paragraph form, it would just be one straight line.
I'm thinking I might have to put it into a picture box.How to put Text into a VB Program?
I think no need to use PictureBox.
There is workaround for this.
Simply take a text box and enable Multiline property on that text box. Then Disable Editing and Selection on Text box.
Helped?
Thanks,
DineshHow to put Text into a VB Program?
I would look into seeing if there is a textbox you can use I don't remember vb all that much but I do remember something about a textbox.
Which version are you using?
If you are in VB 6.0 or later, then you should be able to make it look like a paragraph, by putting the appropriate amount of spaces to make different lines in the box...
Hope this helps.
I tried using a label but it wouldn't let me put it into paragraph form, it would just be one straight line.
I'm thinking I might have to put it into a picture box.How to put Text into a VB Program?
I think no need to use PictureBox.
There is workaround for this.
Simply take a text box and enable Multiline property on that text box. Then Disable Editing and Selection on Text box.
Helped?
Thanks,
DineshHow to put Text into a VB Program?
I would look into seeing if there is a textbox you can use I don't remember vb all that much but I do remember something about a textbox.
Which version are you using?
If you are in VB 6.0 or later, then you should be able to make it look like a paragraph, by putting the appropriate amount of spaces to make different lines in the box...
Hope this helps.
How can I convert VB6 code to VB 2008?
ive tried opening a vb6 file with vb 2008 express and it failed, so is there anyway to do it without rewriting the code?How can I convert VB6 code to VB 2008?
If the program is of any size, you'll get enough errors that you can open an error-selling business. But the only way to port VB6 to VB dot net is by hand. No one has written a good porting program. (Even the automatic conversion in 2003 left half the program or more to be hand-converted.)How can I convert VB6 code to VB 2008?
Copy all the code from your VB6 project and into a new VB08 Project. Then edit out any errors you get. They may/should be only a couple.
in my experience, the best way is to write from scratch. You can reuse parts of the code of course, but the change in paradigm is too big for a straight conversion.
If the program is of any size, you'll get enough errors that you can open an error-selling business. But the only way to port VB6 to VB dot net is by hand. No one has written a good porting program. (Even the automatic conversion in 2003 left half the program or more to be hand-converted.)How can I convert VB6 code to VB 2008?
Copy all the code from your VB6 project and into a new VB08 Project. Then edit out any errors you get. They may/should be only a couple.
in my experience, the best way is to write from scratch. You can reuse parts of the code of course, but the change in paradigm is too big for a straight conversion.
VB 2008: How do i select certain characters in a text box. Eg Select the first 20 characters out of about 100.
Hi i am new to visual basic, and i would like to select the first 85 characters in the text box out of about 150. I would like to highlight those 85 characters too. Please help thanks.VB 2008: How do i select certain characters in a text box. Eg Select the first 20 characters out of about 100.
Dim Ch() As Char = Me.TextBox1.Text.ToCharArray
For Highlighting you will have to change your textbox to a richtextboxVB 2008: How do i select certain characters in a text box. Eg Select the first 20 characters out of about 100.
Right(textbox.text, 1, 20)
Dim Ch() As Char = Me.TextBox1.Text.ToCharArray
For Highlighting you will have to change your textbox to a richtextboxVB 2008: How do i select certain characters in a text box. Eg Select the first 20 characters out of about 100.
Right(textbox.text, 1, 20)
How do you pass variables from one form to another in vb 6.0?
I've got two variables I want to pass from form 1 to form 2. I used Public to declare them as global variables. Then I set two textboxes on the second form to show the values of the two variables, so I could check that it was working but nothing comes up.
Anyone got any ideas?
Thanks in advance!!How do you pass variables from one form to another in vb 6.0?
Since they are global it is pretty easy.
dim otherFrm as form2
form2.variable = xget him to notice me
Anyone got any ideas?
Thanks in advance!!How do you pass variables from one form to another in vb 6.0?
Since they are global it is pretty easy.
dim otherFrm as form2
form2.variable = x
How do you pass variables from one form to another in vb 6.0?
I've got two variables I want to pass from form 1 to form 2. I used Public to declare them as global variables. Then I set two textboxes on the second form to show the values of the two variables, so I could check that it was working but nothing comes up.
Anyone got any ideas?
Thanks in advance!!How do you pass variables from one form to another in vb 6.0?
Since they are global it is pretty easy.
dim otherFrm as form2
form2.variable = x
Anyone got any ideas?
Thanks in advance!!How do you pass variables from one form to another in vb 6.0?
Since they are global it is pretty easy.
dim otherFrm as form2
form2.variable = x
How do I search an Array for a specific number in VB.NET?
In an Array that I have created, I want to be able to look for a specific number, and give me the index of that number.How do I search an Array for a specific number in VB.NET?
Loop through every node in the array and search for it.
For Each s As String in My_Arr
If s.Contains(';14';) Then
...
End If
Next
Dane
Loop through every node in the array and search for it.
For Each s As String in My_Arr
If s.Contains(';14';) Then
...
End If
Next
Dane
Does any know how to create a matching game in VB 2005?
I have 12 picture boxes with 6 distinct pictures as background images. I want the user to be able to match two boxes that have the same pictures. The problem is I can't get the codes to work.Does any know how to create a matching game in VB 2005?
Show us some code so we can help you...
Show us some code so we can help you...
How to access remote desktop using vb.net 2005?
I am doing network administrator project. I would like know how to access client machine desktop and control it from server machine using vb.net 2005. Anyone plz help me....How to access remote desktop using vb.net 2005?
its very simple
2 way of using Remote..
1st live mesh but its slow %26amp; taught
2nd Team Viwer4 its very fast %26amp; real for working %26amp; data transfer and so easy
go with this link
http://www.teamviewer.com/index.aspx
than after Download ';start fill virsion'; software in Desktop
1 or more than computer and run it / install it
than after geat ID %26amp; Password showing and use Remote
Example :
ID 225 236 096
Password : 8823
Connet Remote and work your project
thank you..........
its very simple
2 way of using Remote..
1st live mesh but its slow %26amp; taught
2nd Team Viwer4 its very fast %26amp; real for working %26amp; data transfer and so easy
go with this link
http://www.teamviewer.com/index.aspx
than after Download ';start fill virsion'; software in Desktop
1 or more than computer and run it / install it
than after geat ID %26amp; Password showing and use Remote
Example :
ID 225 236 096
Password : 8823
Connet Remote and work your project
thank you..........
Friday, November 19, 2010
How to convert a VB array to an xml file?
I am writing a program in Visual Basic in which some calculations are made and saved into a two dimensional array. After each time I run the program I would like to save this array as an xml file (or any other format) so that I can later open it in Excel. What should I do to convert the array into an xml file?How to convert a VB array to an xml file?
Write ';%26lt;tagname%26gt;'; data ';%26lt;/tagname%26gt;';
Something like that.How to convert a VB array to an xml file?
If you want to import the data into Excel I wouldn't use XML, I would just use a comma seperated text file (.csv). Just output each row of data like this to a file:
10.00,23.22,1.22,7.22
Write ';%26lt;tagname%26gt;'; data ';%26lt;/tagname%26gt;';
Something like that.How to convert a VB array to an xml file?
If you want to import the data into Excel I wouldn't use XML, I would just use a comma seperated text file (.csv). Just output each row of data like this to a file:
10.00,23.22,1.22,7.22
What vb.net command do you use to count characters in a string?
I am using vb.net express 2007 and cannot figure out how to get my program to count certain characters in a string, then display the findings!What vb.net command do you use to count characters in a string?
value = someString.Length
That's how you get the size of a string. If you want to count certain characters, you'll have to loop over the string char by char using a FOR loop. Then use someString.Chars(i).What vb.net command do you use to count characters in a string?
dim s as string
s=';abc';
dim count as int
i=s.lenght
Use the string.length property to get the length of a string.
Dim s As String
Dim c As Integer
s = ';Hello World';
c = s.Length
Console.WriteLine(c)
Console.ReadLine()
value = someString.Length
That's how you get the size of a string. If you want to count certain characters, you'll have to loop over the string char by char using a FOR loop. Then use someString.Chars(i).What vb.net command do you use to count characters in a string?
dim s as string
s=';abc';
dim count as int
i=s.lenght
Use the string.length property to get the length of a string.
Dim s As String
Dim c As Integer
s = ';Hello World';
c = s.Length
Console.WriteLine(c)
Console.ReadLine()
How can I connect to an access database from an application that has been designed by VB?
Hi,
Goto Main menu
Project-%26gt;References
Then Check
Microsoft ActiveX Data Objects 2.0 Library
Press OK
Now declare a connection variable
dim conn as New connection,rs as new recordset
conn.Open ';Provider=Microsoft.Jet.OLEDB.4.0;Data Source=path\databaseName.mdb';
Now connection is established.
rs.open ';TableName';,conn,,
Recordset is open
Goto Main menu
Project-%26gt;References
Then Check
Microsoft ActiveX Data Objects 2.0 Library
Press OK
Now declare a connection variable
dim conn as New connection,rs as new recordset
conn.Open ';Provider=Microsoft.Jet.OLEDB.4.0;Data Source=path\databaseName.mdb';
Now connection is established.
rs.open ';TableName';,conn,,
Recordset is open
How to crack a password-protected application written IN VB.?
The federal punishment for hacking into computers ranges from a fine or imprisonment for no more than one year to a fine and imprisonment for no more than twenty years. This wide range of punishment depends upon the seriousness of the criminal activity and what damage the hacker has done.
How can I place sound on a form in VB.NET 2003? I also need to have that sound changed during run time?
I'm new to this, so please be detailed.How can I place sound on a form in VB.NET 2003? I also need to have that sound changed during run time?
There is no need to add anything extra to the form.
The .NET framework has everything you need to play sound.
Use the '; My.Computer.Audio '; name space
Use it like this
My.Computer.Audio.Play(';c:\myFileLocat鈥?br>
if you want to change the file string that is in a textbox named textbox1
dim filename as String
filename=textbox1.text
My.Computer.Audio.Stop()
My.Computer.Audio.Play(filename)How can I place sound on a form in VB.NET 2003? I also need to have that sound changed during run time?
You need to add the Media player control, located in the COM Components panel.
Then you will need to add code to handle your media files.
There is no need to add anything extra to the form.
The .NET framework has everything you need to play sound.
Use the '; My.Computer.Audio '; name space
Use it like this
My.Computer.Audio.Play(';c:\myFileLocat鈥?br>
if you want to change the file string that is in a textbox named textbox1
dim filename as String
filename=textbox1.text
My.Computer.Audio.Stop()
My.Computer.Audio.Play(filename)How can I place sound on a form in VB.NET 2003? I also need to have that sound changed during run time?
You need to add the Media player control, located in the COM Components panel.
Then you will need to add code to handle your media files.
How do I import the System.Drawing class into an SSIS VB.NET script?
I am trying to reference an image file in a VB.net script component to get the height and width of a set of images. When I type in Imports System. ';drawing'; is not an option. I think i might have to import from the .net framework, but I am pretty lost. Help?How do I import the System.Drawing class into an SSIS VB.NET script?
Click on Projects,
Click Add References
under the .NET tab scroll down to System.drawing and select it. Press Add.wax get facials
Click on Projects,
Click Add References
under the .NET tab scroll down to System.drawing and select it. Press Add.
How do I keep the same number even after I click the button in VB?
Private Sub btnGuess_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGuess.Click
Dim guess As Integer
Randomize()
' Generate random value between 1 and 100.
Dim x As Integer = CInt(Int((100 * Rnd()) + 1))
guess = CInt(txtGuess.Text)
If guess = x Then
lblHiOrLow.Text = ';You guessed it!';
Else
If guess %26gt; x Then
lblHiOrLow.Text = ';Guess Lower';
Else
lblHiOrLow.Text = ';Guess Higher';
End If
End If
Static intCount As Integer
intCount = intCount + 1
If intCount = 1 Then
lblNumber.Text = ';You've guessed '; %26amp; intCount %26amp; '; time.';
Else
lblNumber.Text = ';You've guessed '; %26amp; intCount %26amp; '; times.';
End If
End Sub
In other words the number keeps changing so obviously its a little hard to guess. How do I get the number then store it?How do I keep the same number even after I click the button in VB?
You need two things, a global variable to store the guess and a global variable to store the state of the program.
You then need to initialize a value at the beginning of the process by running the random number generator, then only resetting the value the time after you have guessed it. You can do this by setting and checking the state variable. If it is the firstGuess, then you will set the value, otherwise you will use the old value.
Once you have found the correct value, then set the state back to firstGuess so that the next time a new value is generated.
You will also need to do the proper accounting for intCount.
Private Sub btnGuess_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGuess.Click
Static guess as Integer
Static firstGuess as Boolean = True
Randomize()
If( firstGuess ) Then
' Generate random value between 1 and 100.
Dim x As Integer = CInt(Int((100 * Rnd()) + 1))
guess = CInt(txtGuess.Text)
firstGuess = False
End If
If guess = x Then
lblHiOrLow.Text = ';You guessed it!';
firstGuess = True
Else
If guess %26gt; x Then
lblHiOrLow.Text = ';Guess Lower';
Else
lblHiOrLow.Text = ';Guess Higher';
End If
End If
Static intCount As Integer
intCount = intCount + 1
If intCount = 1 Then
lblNumber.Text = ';You've guessed '; %26amp; intCount %26amp; '; time.';
Else
lblNumber.Text = ';You've guessed '; %26amp; intCount %26amp; '; times.';
End If
End Sub
Dim guess As Integer
Randomize()
' Generate random value between 1 and 100.
Dim x As Integer = CInt(Int((100 * Rnd()) + 1))
guess = CInt(txtGuess.Text)
If guess = x Then
lblHiOrLow.Text = ';You guessed it!';
Else
If guess %26gt; x Then
lblHiOrLow.Text = ';Guess Lower';
Else
lblHiOrLow.Text = ';Guess Higher';
End If
End If
Static intCount As Integer
intCount = intCount + 1
If intCount = 1 Then
lblNumber.Text = ';You've guessed '; %26amp; intCount %26amp; '; time.';
Else
lblNumber.Text = ';You've guessed '; %26amp; intCount %26amp; '; times.';
End If
End Sub
In other words the number keeps changing so obviously its a little hard to guess. How do I get the number then store it?How do I keep the same number even after I click the button in VB?
You need two things, a global variable to store the guess and a global variable to store the state of the program.
You then need to initialize a value at the beginning of the process by running the random number generator, then only resetting the value the time after you have guessed it. You can do this by setting and checking the state variable. If it is the firstGuess, then you will set the value, otherwise you will use the old value.
Once you have found the correct value, then set the state back to firstGuess so that the next time a new value is generated.
You will also need to do the proper accounting for intCount.
Private Sub btnGuess_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGuess.Click
Static guess as Integer
Static firstGuess as Boolean = True
Randomize()
If( firstGuess ) Then
' Generate random value between 1 and 100.
Dim x As Integer = CInt(Int((100 * Rnd()) + 1))
guess = CInt(txtGuess.Text)
firstGuess = False
End If
If guess = x Then
lblHiOrLow.Text = ';You guessed it!';
firstGuess = True
Else
If guess %26gt; x Then
lblHiOrLow.Text = ';Guess Lower';
Else
lblHiOrLow.Text = ';Guess Higher';
End If
End If
Static intCount As Integer
intCount = intCount + 1
If intCount = 1 Then
lblNumber.Text = ';You've guessed '; %26amp; intCount %26amp; '; time.';
Else
lblNumber.Text = ';You've guessed '; %26amp; intCount %26amp; '; times.';
End If
End Sub
How can you add multiple rows to an Excel 2003 Worksheet without using the VB editor or other programming?
highlight multiple cells, and click the ';insert row'; icon.
if you dont have the icon...then highlight multiple rows (by clicking on the numbers on the left), then right click in your highlighted area and click insert.
add the insert row icon, i use mine all the time.How can you add multiple rows to an Excel 2003 Worksheet without using the VB editor or other programming?
select a cell, press Shift key and down arrow to select how many rows we would like to added %26gt; Enter, then
Ctrl C (shortcut for copy)
Alt I
Enter
This should give us multiple rows without VBA or mouse pointer. Good luck.
if you dont have the icon...then highlight multiple rows (by clicking on the numbers on the left), then right click in your highlighted area and click insert.
add the insert row icon, i use mine all the time.How can you add multiple rows to an Excel 2003 Worksheet without using the VB editor or other programming?
select a cell, press Shift key and down arrow to select how many rows we would like to added %26gt; Enter, then
Ctrl C (shortcut for copy)
Alt I
Enter
This should give us multiple rows without VBA or mouse pointer. Good luck.
How do I load ANY text file using a button into ListBox1 in the vb.net programming language?
This means, each line in the text file will be read in ListBox1 as each line. Example: I have a text file with entries:
andrea
bob
gordon
When I click on my button a dialog box pops up and allows me to load a text file. Once loaded itll load into the ListBox1 like:
andrea
bob
gordonHow do I load ANY text file using a button into ListBox1 in the vb.net programming language?
This should do it. It's a library routine so I made it public/static. However, if you just want to stick it in a form, you could easily make it private and lose both parameters in favor of specifying the list box and filename directly. (I like library routines, though!)
public static void PopulateListBoxFromFile( ListBox listbox, string filename )
{
// Clear anything already in the list box
listbox.Items.Clear();
// Use the using keyword to ensure that the stream
// reader will be disposed after use
using ( StreamReader reader = new StreamReader( filename ) )
{
string line;
// Read lines from the file until there are no more lines
while ( ( line = reader.ReadLine() ) != null )
{
listbox.Items.Add( line );
}
}
}
andrea
bob
gordon
When I click on my button a dialog box pops up and allows me to load a text file. Once loaded itll load into the ListBox1 like:
andrea
bob
gordonHow do I load ANY text file using a button into ListBox1 in the vb.net programming language?
This should do it. It's a library routine so I made it public/static. However, if you just want to stick it in a form, you could easily make it private and lose both parameters in favor of specifying the list box and filename directly. (I like library routines, though!)
public static void PopulateListBoxFromFile( ListBox listbox, string filename )
{
// Clear anything already in the list box
listbox.Items.Clear();
// Use the using keyword to ensure that the stream
// reader will be disposed after use
using ( StreamReader reader = new StreamReader( filename ) )
{
string line;
// Read lines from the file until there are no more lines
while ( ( line = reader.ReadLine() ) != null )
{
listbox.Items.Add( line );
}
}
}
How do i get started to program VB.net?
I am trying to study and begin programming vb.net. I have all the notes needed but I am missing the most important piece, and that is the program. Where can I download Vb.net 2003 as that is what the book is currently using.How do i get started to program VB.net?
There's no reason you need to use the same version of VB.NET. Little, if anything, will be different. Just go here:
http://www.microsoft.com/Express/VB/
There's no reason you need to use the same version of VB.NET. Little, if anything, will be different. Just go here:
http://www.microsoft.com/Express/VB/
How to create a number of textboxes in the form during runtime for VB in excel?
Forget it
VBA of Excel (up to Excel2007) does not have the ';Control Array'; feature as in regular VB
simply because the ';Index'; property is not there
You will need to do alternatives
Trust me, VBAXLMan is back and knows what he is talking aboutHow to create a number of textboxes in the form during runtime for VB in excel?
Sorry I missed the Excel part...
It really depends on what you want to achieve by doing this. However you will need to have them created on a particular event such as the user clicking a button or somthing or you could write a VBA sub / function that runs a timer in the background with the text boxes being created on timer event. Without knowing further details I would suggest that you create the text boxes on the form in design mode and then change their 'visible' property to false so that they are hidden and the when the user triggers the event / action then change the text box visible property to true.
Use an array.
1. On your form, create a textbox (Text1).
2. Change Text1.Index to ';0'; (This must be done at design time, using the Properties box)
3. Create a button (Command1).
4. Enter this code for Command1:
Private Sub Command1_Click()
Static i As Integer
If i %26lt; 1 Then i = 1
Load Text1(i)
Text1(i).Text = ';New TextBox '; %26amp; i
Text1(i).Visible = True
Text1(i).Top = Text1(i - 1).Top + Text1(i - 1).Height
i = i + 1
End Sub
Each time Command1 is clicked a new textbox is created below the previous one.
Obviously, you can call the code using something other then a command.
If you don't know how VB uses the .index I suggest you read up on it on MSDN or something, it's pretty simple.
Don't forget to set the properties of your new control.
VBA of Excel (up to Excel2007) does not have the ';Control Array'; feature as in regular VB
simply because the ';Index'; property is not there
You will need to do alternatives
Trust me, VBAXLMan is back and knows what he is talking aboutHow to create a number of textboxes in the form during runtime for VB in excel?
Sorry I missed the Excel part...
Report Abuse
How to create a number of textboxes in the form during runtime for VB in excel?It really depends on what you want to achieve by doing this. However you will need to have them created on a particular event such as the user clicking a button or somthing or you could write a VBA sub / function that runs a timer in the background with the text boxes being created on timer event. Without knowing further details I would suggest that you create the text boxes on the form in design mode and then change their 'visible' property to false so that they are hidden and the when the user triggers the event / action then change the text box visible property to true.
Use an array.
1. On your form, create a textbox (Text1).
2. Change Text1.Index to ';0'; (This must be done at design time, using the Properties box)
3. Create a button (Command1).
4. Enter this code for Command1:
Private Sub Command1_Click()
Static i As Integer
If i %26lt; 1 Then i = 1
Load Text1(i)
Text1(i).Text = ';New TextBox '; %26amp; i
Text1(i).Visible = True
Text1(i).Top = Text1(i - 1).Top + Text1(i - 1).Height
i = i + 1
End Sub
Each time Command1 is clicked a new textbox is created below the previous one.
Obviously, you can call the code using something other then a command.
If you don't know how VB uses the .index I suggest you read up on it on MSDN or something, it's pretty simple.
Don't forget to set the properties of your new control.
What is the adavntage to use twips in VB?
A twip (loosely from twentieth of a point) is a typographical measurement, defined as 1/20 of a typographical point. One twip is 1/1440 inch or 1.7639 碌m when derived from the PostScript point at 72 to the inch, and 1/1445.4 inch or 1.7573 碌m based on the printer's point at 72.27 to the inch.
[edit] Twips in computing
Twips are the default unit of measurement in Visual Basic (version 6 and earlier, prior to VB.NET). When in Microsoft Windows ';small fonts'; mode, 15 twips are equal to one pixel. 1cm is equal to 567 twips.
Twips are also a commonly used unit with Symbian OS bitmap images.
(if device independent is the advanage then what does it mean(how can it be device independent if it is depends on the resolution??))What is the adavntage to use twips in VB?
The first half of your question is the 'why'. What the second part didn't elaborate on is that 15 twips equal one pixel on a specific platform at a specific resolution (Wikipedia's a bit short-changed on that bit of information). The resolution of a monitor and it's physical size come into play when determining the twips:pixel ratio.
Twips were used so that no matter what the environment, things would look the same. When you get right down to it, the pixel is the native unit on a monitor. Twips were most likely a holdover from the earlier paradigm of digital media as an alternate form of print media.
[edit] Twips in computing
Twips are the default unit of measurement in Visual Basic (version 6 and earlier, prior to VB.NET). When in Microsoft Windows ';small fonts'; mode, 15 twips are equal to one pixel. 1cm is equal to 567 twips.
Twips are also a commonly used unit with Symbian OS bitmap images.
(if device independent is the advanage then what does it mean(how can it be device independent if it is depends on the resolution??))What is the adavntage to use twips in VB?
The first half of your question is the 'why'. What the second part didn't elaborate on is that 15 twips equal one pixel on a specific platform at a specific resolution (Wikipedia's a bit short-changed on that bit of information). The resolution of a monitor and it's physical size come into play when determining the twips:pixel ratio.
Twips were used so that no matter what the environment, things would look the same. When you get right down to it, the pixel is the native unit on a monitor. Twips were most likely a holdover from the earlier paradigm of digital media as an alternate form of print media.
How would I do Loops in VB 2008?
I want to check if the time is at a certain preset time. How would I make it keep on checking?How would I do Loops in VB 2008?
You can't do it with a loop, because you would be locked in and the program couldn't do anything else.
What I would recommend is a ';Timer';. You would find it in the ';ToolBox'; to the left edge of the screen.
Set up the start time, the time delay, and a procedure that will run during the interval time delay to check if the preset time has elapsed.
You can't do it with a loop, because you would be locked in and the program couldn't do anything else.
What I would recommend is a ';Timer';. You would find it in the ';ToolBox'; to the left edge of the screen.
Set up the start time, the time delay, and a procedure that will run during the interval time delay to check if the preset time has elapsed.
How to Embedd an image icon in vb.net application?
I want to add an image icon (like my computer on desktop) in vb.net application.How to do it?How to Embedd an image icon in vb.net application?
Add the icon file to your project.
Click on the file and change the ';Build Action'; to ';Embedded Resource';
Then in your code
Dim icoNormal as icon
icoNormal = New Icon(System.Reflection.Assembly.GetExecu鈥?br>
Changing %26lt;%26lt;ProjectName%26gt;%26gt; to your assembly name for your project
and %26lt;%26lt;IconFile%26gt;%26gt; to the name of the icon file.
Remember to keep the period (.) in between the two names.
eg
icoNormal = New Icon(System.Reflection.Assembly.GetExecu鈥?br>
If you don't know your assembly name they click on ';Project'; and ';Project Properties';How to Embedd an image icon in vb.net application?
As the icon for the program? As an .ico file the program is going to write to disk?
Add the icon file to your project.
Click on the file and change the ';Build Action'; to ';Embedded Resource';
Then in your code
Dim icoNormal as icon
icoNormal = New Icon(System.Reflection.Assembly.GetExecu鈥?br>
Changing %26lt;%26lt;ProjectName%26gt;%26gt; to your assembly name for your project
and %26lt;%26lt;IconFile%26gt;%26gt; to the name of the icon file.
Remember to keep the period (.) in between the two names.
eg
icoNormal = New Icon(System.Reflection.Assembly.GetExecu鈥?br>
If you don't know your assembly name they click on ';Project'; and ';Project Properties';How to Embedd an image icon in vb.net application?
As the icon for the program? As an .ico file the program is going to write to disk?
How do you show a message box error in visual basic? vb programmers, help plz?
it needs to come up if the numbers entered in the previoustextbox.text and the currenttextbox.text aren't numbers or if the currenttextbox.text has a lower number than the previoustextbox.text..
something like if previous=';'; then messagebox.show blah blah blah...i dont know what goes in the quotations....plz helpHow do you show a message box error in visual basic? vb programmers, help plz?
MsgBox(';Bla Bla...';, MsgBoxStyle.Critical, ';Error!';)How do you show a message box error in visual basic? vb programmers, help plz?
Something like this (this is VB .net), but vb6 has IsNumeric() function as well.
This tells whether it is a number INT and SINGLE, DOUBLE and whether current is less than previous.
You must cast string ';'; as a number. Function checks clean to see if math function would cause an error. If they are numbers then proceed to math check.
Dim text As String = ';123.50';
Dim previous_text As String = ';123';
If IS_number(text) And IS_number(previous_text) Then
MsgBox(';number';)
If CSng(text) %26lt; CSng(previous_text) Then
MsgBox(';current is less than previous';)
Else
MsgBox(';current is NOT less than previous';)
End If
Else
MsgBox(';one or both is/are not number';)
End If
End Sub
Public Function IS_number(ByVal text As String) As Boolean
For Each character In text.ToCharArray
If Not IsNumeric(character) And character %26lt;%26gt; ';.'; Then
Return False
Exit Function
End If
Next
Return True
End Function
Good Luck.
something like if previous=';'; then messagebox.show blah blah blah...i dont know what goes in the quotations....plz helpHow do you show a message box error in visual basic? vb programmers, help plz?
MsgBox(';Bla Bla...';, MsgBoxStyle.Critical, ';Error!';)How do you show a message box error in visual basic? vb programmers, help plz?
Something like this (this is VB .net), but vb6 has IsNumeric() function as well.
This tells whether it is a number INT and SINGLE, DOUBLE and whether current is less than previous.
You must cast string ';'; as a number. Function checks clean to see if math function would cause an error. If they are numbers then proceed to math check.
Dim text As String = ';123.50';
Dim previous_text As String = ';123';
If IS_number(text) And IS_number(previous_text) Then
MsgBox(';number';)
If CSng(text) %26lt; CSng(previous_text) Then
MsgBox(';current is less than previous';)
Else
MsgBox(';current is NOT less than previous';)
End If
Else
MsgBox(';one or both is/are not number';)
End If
End Sub
Public Function IS_number(ByVal text As String) As Boolean
For Each character In text.ToCharArray
If Not IsNumeric(character) And character %26lt;%26gt; ';.'; Then
Return False
Exit Function
End If
Next
Return True
End Function
Good Luck.
How to open a jar file in VB?
I just want VB to open a ******* JAR file that is in the same folder, how limited is VB?! I'm not a VB developer, but a Java developer, I just want people to install the software and open it as an exe file! BTW: I'm really tired, I've been up all night programming a server software in Java...How to open a jar file in VB?
Make sure you ';Import'; System.Diagnostics at the top of the file
The documentation can be found here: http://msdn.microsoft.com/en-us/library/鈥?/a>
Dim processStartInfo As New ProcessStartInfo(';someFile.jar';);
processStartInfo.CreateNoWindow = true;
processStartInfo.UseShellExecute = false;
Dim process As Process = Process.Start(processStartInfo);
process.WaitForExit();
Dim exitCode As Integer = Process.ExitCode;
' Do something with ExitCode if you want
process.Close();
BTW, if you are a Java developer you should consider using C# if possible. It can ';talk'; to any code developed in VB and the syntax is almost identical to Java.advice for door installation
Make sure you ';Import'; System.Diagnostics at the top of the file
The documentation can be found here: http://msdn.microsoft.com/en-us/library/鈥?/a>
Dim processStartInfo As New ProcessStartInfo(';someFile.jar';);
processStartInfo.CreateNoWindow = true;
processStartInfo.UseShellExecute = false;
Dim process As Process = Process.Start(processStartInfo);
process.WaitForExit();
Dim exitCode As Integer = Process.ExitCode;
' Do something with ExitCode if you want
process.Close();
BTW, if you are a Java developer you should consider using C# if possible. It can ';talk'; to any code developed in VB and the syntax is almost identical to Java.
How to make a square root in VB console Application.?
How to make a square root in VB console Application.?
i am trying to make a program that solves quadratic equations in visual basic console application.
please i really need help.
thanksHow to make a square root in VB console Application.?
use
Val(Textbox1.text)^(1/2)
that means that the value of textbox1.text(or whatever) is to the power of 1/2 which is a square root
i am trying to make a program that solves quadratic equations in visual basic console application.
please i really need help.
thanksHow to make a square root in VB console Application.?
use
Val(Textbox1.text)^(1/2)
that means that the value of textbox1.text(or whatever) is to the power of 1/2 which is a square root
How to upload a VB game onto internet?
I just programmed a simple Visual Basic game based on SpaceBlitz. Its a game for class, but apparently the computer at the school can't run .exe files. Which is odd. So my teacher recommended me to some how put it on the internet like those flashgames. Although I'm new at this so can someone give me input? And where might i upload it on thats safe.
The files consist of
play.exe
Graphic folder
Sound folder
thanks basically it.How to upload a VB game onto internet?
You won't be able to play the game like a flash game, even if you posted it to a website, the computer would just download and try to run the exe (assuming their proxy doesn't block it).
It sounds like your school's admin is blocking unapproved applications, so you will have no chance on running this game on you school's computer unless he/she allows it.
The files consist of
play.exe
Graphic folder
Sound folder
thanks basically it.How to upload a VB game onto internet?
You won't be able to play the game like a flash game, even if you posted it to a website, the computer would just download and try to run the exe (assuming their proxy doesn't block it).
It sounds like your school's admin is blocking unapproved applications, so you will have no chance on running this game on you school's computer unless he/she allows it.
How to save multiple arrays in vb.net?
I am trying to a build decision tree in vb.net. Can someone please help me with suggestions on how to save the various nodes as the tree builds and grows bigger.How to save multiple arrays in vb.net?
If you're using .Net 2.0 or above try using generics. A List or Dictionary could work well.
I don't know VB.Net only C# so check out this it could help.
http://www.ondotnet.com/pub/a/dotnet/2004/05/25/whidbey_vbnet_pt2.html
If you're using .Net 2.0 or above try using generics. A List or Dictionary could work well.
I don't know VB.Net only C# so check out this it could help.
http://www.ondotnet.com/pub/a/dotnet/2004/05/25/whidbey_vbnet_pt2.html
How to add a picture to the background of a vb.net form ?
Can anyone give me the correct code ?How to add a picture to the background of a vb.net form ?
Me.BackgroundImage = Image.FromFile(';C:\DSC00078.GIF';)
Me.BackgroundImage = Image.FromFile(';C:\DSC00078.GIF';)
How can i store and retreive values in system registry through VB.NET.?
How can i store and retreive values in system registry through VB.NET. i want to store an ip address in the system registry and then use that for further reference and use.How can i store and retreive values in system registry through VB.NET.?
Why store it in the registry?
Won't you be better off creating a text file (e.g. settings or config file) and including the value in there?
For your question, try the following links:
http://it.toolbox.com/wiki/index.php/Win鈥?/a>
http://www.codeguru.com/csharp/csharp/cs鈥?/a>
http://articles.techrepublic.com.com/510鈥?/a>
Why store it in the registry?
Won't you be better off creating a text file (e.g. settings or config file) and including the value in there?
For your question, try the following links:
http://it.toolbox.com/wiki/index.php/Win鈥?/a>
http://www.codeguru.com/csharp/csharp/cs鈥?/a>
http://articles.techrepublic.com.com/510鈥?/a>
How to add data from textboxes in datareports in vb?
I want to make a data report and i want to add the data from textbox in datareport. please help me in doing so...ThanxHow to add data from textboxes in datareports in vb?
First you have to create Data Environment.
Creating a Data Environment
1. Start a new Standard EXE project.
2. On the Project menu, click Add Data Environment. If this item is not on the menu, click Components. Click the Designers tab, and choose Data Environment and click OK to add the designer to your menu.
3. We need to point to our database. In the Data Environment window, right-click the Connection1 tab and select Properties. In the Data Link Properties dialog box, choose the database in which you have created by DB Provider. Click Next to get to the Connection tab. Click the ellipsis button. Find your database (mdb) file. Click OK to close the dialog box.
4. We now tell the Data Environment what is in our database. Right-click the Connection1 tab and click Rename. Change the name of the tab to Phone. Right-click this newly named tab and click Add Command to create a Command1 tab. Right-click this tab and choose Properties. Assign the following properties:
Command Name -
Connection -
DataBase Object - Table
ObjectName -
5. Click OK. All this was needed just to connect the environment to our database.
6. Display the properties window and give the data environment a name property of den(name). Click File and Save den(name) As. Save the environment in an appropriate folder. We will eventually add this file to our phone database management system.
After that now you have to create Data Report. Follow these simple steps:-
Once the Data Environment has been created, we can create a Data Report. We will drag things out of the Data Environment onto a form created for the Data Report, so make sure your Data Environment window is still available.
1. On the Project menu, click Add Data Report and one will be added to your project. If this item is not on the menu, click Components. Click the Designers tab, and choose Data Report and click OK to add the designer to your menu.
2. Set the following properties for the report:
Name - rpt(name)
Caption - (name)
DataSource - den(name) (your data environment - choose, don鈥檛 type)
DataMember - List (the table name - choose don鈥檛 type)
3. Right-click the Data Report and click Retrieve Structure. This establishes a report format based on the Data Environment.
4. Note there are five sections to the data report: a Report Header, a Page Header, a Detail section, a Page Footer, and a Report Footer. The headers and footers contain information you want printed in the report and on each page. To place information in one of these regions, right-click the selected region, click Add Control, then choose the control you wish to place. These controls are called data report controls and properties are established just like you do for usual controls. Try adding some headers.
5. The Detail section is used to layout the information you want printed for each record in your database. We will place two field listings (Name, Phone) there. Click on the Name tab in the Data Environment window and drag it to the Detail section of the Data Report. Two items should appear: a text box Name and a text box Name ((name)List). The first text box is heading information. Move this text box into the Page Header section. The second text box is the actual value for Name from the (name)List table. Line this text box up under the Name header. Now, drag the Phone tab from the Data Environment to the Data Report. Adjust the text boxes in the same manner. Our data report will have page headers . Under these headers, these fields for each record in our database will be displayed.
6. Click File and Save rpt(name) As. Save the environment in an appropriate folder. We will now reopen our phone database manager and attach this and the data environment to that project and add capabilities to display the report.
Accessing the Data Report
1. Reopen the phone directory project. Add a command button named cmdReport and give it a Caption of Show Report. (There may be two tabs in your toolbox, one named General and one named DataReport. Make sure you select from the General tools.)
2. We will now add the data environment and data report files to the project. Click the Project menu item, then click Add File. Choose den(name) and click OK. Also add rpt(name). Look at your Project Window. Those files should be listed under Designers.
3. Use this code in cmdReport_Click:
Private Sub cmdReport_Click()
rpt(name).Show
End Sub
4. This uses the Show method to display the data report.
Your database report is ready.How to add data from textboxes in datareports in vb?
Give a point to Bunty...
For easier and quick solution related to Visual Basic programming, be a member of http://www.vbforums.com .
I ensure you for the quick answers.
First you have to create Data Environment.
Creating a Data Environment
1. Start a new Standard EXE project.
2. On the Project menu, click Add Data Environment. If this item is not on the menu, click Components. Click the Designers tab, and choose Data Environment and click OK to add the designer to your menu.
3. We need to point to our database. In the Data Environment window, right-click the Connection1 tab and select Properties. In the Data Link Properties dialog box, choose the database in which you have created by DB Provider. Click Next to get to the Connection tab. Click the ellipsis button. Find your database (mdb) file. Click OK to close the dialog box.
4. We now tell the Data Environment what is in our database. Right-click the Connection1 tab and click Rename. Change the name of the tab to Phone. Right-click this newly named tab and click Add Command to create a Command1 tab. Right-click this tab and choose Properties. Assign the following properties:
Command Name -
Connection -
DataBase Object - Table
ObjectName -
5. Click OK. All this was needed just to connect the environment to our database.
6. Display the properties window and give the data environment a name property of den(name). Click File and Save den(name) As. Save the environment in an appropriate folder. We will eventually add this file to our phone database management system.
After that now you have to create Data Report. Follow these simple steps:-
Once the Data Environment has been created, we can create a Data Report. We will drag things out of the Data Environment onto a form created for the Data Report, so make sure your Data Environment window is still available.
1. On the Project menu, click Add Data Report and one will be added to your project. If this item is not on the menu, click Components. Click the Designers tab, and choose Data Report and click OK to add the designer to your menu.
2. Set the following properties for the report:
Name - rpt(name)
Caption - (name)
DataSource - den(name) (your data environment - choose, don鈥檛 type)
DataMember - List (the table name - choose don鈥檛 type)
3. Right-click the Data Report and click Retrieve Structure. This establishes a report format based on the Data Environment.
4. Note there are five sections to the data report: a Report Header, a Page Header, a Detail section, a Page Footer, and a Report Footer. The headers and footers contain information you want printed in the report and on each page. To place information in one of these regions, right-click the selected region, click Add Control, then choose the control you wish to place. These controls are called data report controls and properties are established just like you do for usual controls. Try adding some headers.
5. The Detail section is used to layout the information you want printed for each record in your database. We will place two field listings (Name, Phone) there. Click on the Name tab in the Data Environment window and drag it to the Detail section of the Data Report. Two items should appear: a text box Name and a text box Name ((name)List). The first text box is heading information. Move this text box into the Page Header section. The second text box is the actual value for Name from the (name)List table. Line this text box up under the Name header. Now, drag the Phone tab from the Data Environment to the Data Report. Adjust the text boxes in the same manner. Our data report will have page headers . Under these headers, these fields for each record in our database will be displayed.
6. Click File and Save rpt(name) As. Save the environment in an appropriate folder. We will now reopen our phone database manager and attach this and the data environment to that project and add capabilities to display the report.
Accessing the Data Report
1. Reopen the phone directory project. Add a command button named cmdReport and give it a Caption of Show Report. (There may be two tabs in your toolbox, one named General and one named DataReport. Make sure you select from the General tools.)
2. We will now add the data environment and data report files to the project. Click the Project menu item, then click Add File. Choose den(name) and click OK. Also add rpt(name). Look at your Project Window. Those files should be listed under Designers.
3. Use this code in cmdReport_Click:
Private Sub cmdReport_Click()
rpt(name).Show
End Sub
4. This uses the Show method to display the data report.
Your database report is ready.How to add data from textboxes in datareports in vb?
Give a point to Bunty...
For easier and quick solution related to Visual Basic programming, be a member of http://www.vbforums.com .
I ensure you for the quick answers.
How do you get DirectX 7 for VB to give you access to the object behind that 'unknown' interface?
Is There a way to use the DirectX7 object provided by VB without creating a reference to the DirectX7 for VB Library in your project. I am a huge fan of COM Automation and scripting and I'd prefer not to reference ANYTHING in any of my VB projects. When I use CreateObject to get an instance of the DirectX7 class, I get an object of type 'unknown'. From what I know, the IUnknown interface isn't documented much and isn't really supported in VB! Help! Again!How do you get DirectX 7 for VB to give you access to the object behind that 'unknown' interface?
Let's resolve this overdue question by bringing it to a vote.How do you get DirectX 7 for VB to give you access to the object behind that 'unknown' interface?
IUnknown is the generic Com interface for all Com objects. In genreal you do a QueryInterface on the object and get the interface you need. You can't do anything with the IUnknown interface. Unfotunally you will probably have to reference the DirectX7 Lib to get the needed interfaces, after all that is what it is there for.
You may want to check out Managed DirectX in VB.NET
Let's resolve this overdue question by bringing it to a vote.How do you get DirectX 7 for VB to give you access to the object behind that 'unknown' interface?
IUnknown is the generic Com interface for all Com objects. In genreal you do a QueryInterface on the object and get the interface you need. You can't do anything with the IUnknown interface. Unfotunally you will probably have to reference the DirectX7 Lib to get the needed interfaces, after all that is what it is there for.
You may want to check out Managed DirectX in VB.NET
How could I make a VB 2005 program that disables the mouse and keyboard until next reboot?
how could I make a VB 2005 program that disables the mouse and keyboard until next reboot?
who ever tells me how to do I will choose them as best answer!
Ps. I have no bad intentions if I get a answer.How could I make a VB 2005 program that disables the mouse and keyboard until next reboot?
make a service that handles all of the key events and mouse events.
who ever tells me how to do I will choose them as best answer!
Ps. I have no bad intentions if I get a answer.How could I make a VB 2005 program that disables the mouse and keyboard until next reboot?
make a service that handles all of the key events and mouse events.
How do I view files of other computers using VB .Net code?
I'm creating some sort of a remote monitoring application. As the administrator, I should also be able to have read / write access to the file directories in a networked computer. Any ideas on specific sites that would help me on this?How do I view files of other computers using VB .Net code?
I made something similar a little while back.
Create a winsock application.
Make the commands on the client side to do what you want on the server side.
http://www.google.com/search?hl=en%26amp;q=win鈥?/a>
DaneHow do I view files of other computers using VB .Net code?
not sure about a site but make a tcp server and client and on the server when requested it should send over the requested file as bytes and then the client would take the bites and decode them
I made something similar a little while back.
Create a winsock application.
Make the commands on the client side to do what you want on the server side.
http://www.google.com/search?hl=en%26amp;q=win鈥?/a>
DaneHow do I view files of other computers using VB .Net code?
not sure about a site but make a tcp server and client and on the server when requested it should send over the requested file as bytes and then the client would take the bites and decode them
How do you launch an exe file in VB without using its full address for like files that are in the same folder?
I want to launch an external .exe program from my Visual Basic Application, but it needs to be in the same directory, that could change multiple times. Is there anyway of the application finding out the address itself and then finding the file? like... Process.Start(';$GetDirectory$/Applicatio鈥? except ofcourse, $GetDirectory$ being the command that makes it find the directory.How do you launch an exe file in VB without using its full address for like files that are in the same folder?
-----
Well it's harder to do this in VBA. In VB you could just use App.Path. That doesn't work in VBA. There's a few things you could try. If you're using Access, try CurrentProject.Path. Or if you're using Excel, try ThisWorkbook.Path. If you're using Word try ActiveDocument.Path.
For different applications there's a different object you have to use.
Hope this helps!
-----
I think I misread your question. If it's just a normal VB application, just use App.Path to get the application path. There is one trick though. If the path is ';C:'; there will be no ';\';, unlike other paths (e.g. ';C:\Program Files\';). To compensate for this, I usually create another variable (call it AppPath for instance), which I set as follows:
Dim AppPath as String
AppPath = App.Path
if right(AppPath, 1) %26lt;%26gt; ';\'; then
AppPath = AppPath %26amp; ';\';
end if
AppPath can then be used in place of your $GetDirectory$ for instance:
Process.Start(AppPath %26amp; ';programname.exe';)How do you launch an exe file in VB without using its full address for like files that are in the same folder?
Finding it somewhere on the same computer, with no restraints?
Find all the drives. Start with the first one and walk the directory structure looking for the fgile. (There's no guarantee that the file you find is actually the one you want. Someone else may have created a file with the same name.)
You can find directory walking code all over the internet. Karen's replicator has good code in VB6.
use ';App.Path'; and concatenate it with the application name to run
for example
Process.Start( App.Path %26amp; ';Application1.exe'; )
hope this helps.how to view private myspace
-----
Well it's harder to do this in VBA. In VB you could just use App.Path. That doesn't work in VBA. There's a few things you could try. If you're using Access, try CurrentProject.Path. Or if you're using Excel, try ThisWorkbook.Path. If you're using Word try ActiveDocument.Path.
For different applications there's a different object you have to use.
Hope this helps!
-----
I think I misread your question. If it's just a normal VB application, just use App.Path to get the application path. There is one trick though. If the path is ';C:'; there will be no ';\';, unlike other paths (e.g. ';C:\Program Files\';). To compensate for this, I usually create another variable (call it AppPath for instance), which I set as follows:
Dim AppPath as String
AppPath = App.Path
if right(AppPath, 1) %26lt;%26gt; ';\'; then
AppPath = AppPath %26amp; ';\';
end if
AppPath can then be used in place of your $GetDirectory$ for instance:
Process.Start(AppPath %26amp; ';programname.exe';)How do you launch an exe file in VB without using its full address for like files that are in the same folder?
Finding it somewhere on the same computer, with no restraints?
Find all the drives. Start with the first one and walk the directory structure looking for the fgile. (There's no guarantee that the file you find is actually the one you want. Someone else may have created a file with the same name.)
You can find directory walking code all over the internet. Karen's replicator has good code in VB6.
use ';App.Path'; and concatenate it with the application name to run
for example
Process.Start( App.Path %26amp; ';Application1.exe'; )
hope this helps.
How do you launch an exe file in VB without using its full address for like files that are in the same folder?
I want to launch an external .exe program from my Visual Basic Application, but it needs to be in the same directory, that could change multiple times. Is there anyway of the application finding out the address itself and then finding the file? like... Process.Start(';$GetDirectory$/Applicatio鈥? except ofcourse, $GetDirectory$ being the command that makes it find the directory.How do you launch an exe file in VB without using its full address for like files that are in the same folder?
-----
Well it's harder to do this in VBA. In VB you could just use App.Path. That doesn't work in VBA. There's a few things you could try. If you're using Access, try CurrentProject.Path. Or if you're using Excel, try ThisWorkbook.Path. If you're using Word try ActiveDocument.Path.
For different applications there's a different object you have to use.
Hope this helps!
-----
I think I misread your question. If it's just a normal VB application, just use App.Path to get the application path. There is one trick though. If the path is ';C:'; there will be no ';\';, unlike other paths (e.g. ';C:\Program Files\';). To compensate for this, I usually create another variable (call it AppPath for instance), which I set as follows:
Dim AppPath as String
AppPath = App.Path
if right(AppPath, 1) %26lt;%26gt; ';\'; then
AppPath = AppPath %26amp; ';\';
end if
AppPath can then be used in place of your $GetDirectory$ for instance:
Process.Start(AppPath %26amp; ';programname.exe';)How do you launch an exe file in VB without using its full address for like files that are in the same folder?
Finding it somewhere on the same computer, with no restraints?
Find all the drives. Start with the first one and walk the directory structure looking for the fgile. (There's no guarantee that the file you find is actually the one you want. Someone else may have created a file with the same name.)
You can find directory walking code all over the internet. Karen's replicator has good code in VB6.
use ';App.Path'; and concatenate it with the application name to run
for example
Process.Start( App.Path %26amp; ';Application1.exe'; )
hope this helps.
-----
Well it's harder to do this in VBA. In VB you could just use App.Path. That doesn't work in VBA. There's a few things you could try. If you're using Access, try CurrentProject.Path. Or if you're using Excel, try ThisWorkbook.Path. If you're using Word try ActiveDocument.Path.
For different applications there's a different object you have to use.
Hope this helps!
-----
I think I misread your question. If it's just a normal VB application, just use App.Path to get the application path. There is one trick though. If the path is ';C:'; there will be no ';\';, unlike other paths (e.g. ';C:\Program Files\';). To compensate for this, I usually create another variable (call it AppPath for instance), which I set as follows:
Dim AppPath as String
AppPath = App.Path
if right(AppPath, 1) %26lt;%26gt; ';\'; then
AppPath = AppPath %26amp; ';\';
end if
AppPath can then be used in place of your $GetDirectory$ for instance:
Process.Start(AppPath %26amp; ';programname.exe';)How do you launch an exe file in VB without using its full address for like files that are in the same folder?
Finding it somewhere on the same computer, with no restraints?
Find all the drives. Start with the first one and walk the directory structure looking for the fgile. (There's no guarantee that the file you find is actually the one you want. Someone else may have created a file with the same name.)
You can find directory walking code all over the internet. Karen's replicator has good code in VB6.
use ';App.Path'; and concatenate it with the application name to run
for example
Process.Start( App.Path %26amp; ';Application1.exe'; )
hope this helps.
How Can i show a diffirent form in VB 2008 (Read Discription)?
Ok so i added a existing project to my current one and i cant seem to launch forms from the other project please helpHow Can i show a diffirent form in VB 2008 (Read Discription)?
If you added the old project to a solution containing the new project, you'll also have to add a reference to the project.In the project that you want to display the forms from, right click the references folder in the solution manager and add one pointing to the other project If you are calling these forms in code, add the correct Imports line at the top of the code file as well.
If you just added the files, make sure the namespace on the files are all correct.
If you added the old project to a solution containing the new project, you'll also have to add a reference to the project.In the project that you want to display the forms from, right click the references folder in the solution manager and add one pointing to the other project If you are calling these forms in code, add the correct Imports line at the top of the code file as well.
If you just added the files, make sure the namespace on the files are all correct.
How can I determine total CPU usage in VB?
I have an Access database, and I'm looking to retrieve, in my VBA code, the total CPU Usage % that you see at the bottom of the Wndows Task Manager. I've just about given up, and could use any help available. Using XP Home Edition and Access 2003.
Please include any needed DLL references.How can I determine total CPU usage in VB?
Here are two possible solution sets:
http://forums.microsoft.com/MSDN/ShowPos鈥?/a>
______________How can I determine total CPU usage in VB?
From VBA you can use only a COM object to get the CPU usage.
Read the KB on the link.. it's a start point.
Please include any needed DLL references.How can I determine total CPU usage in VB?
Here are two possible solution sets:
http://forums.microsoft.com/MSDN/ShowPos鈥?/a>
______________How can I determine total CPU usage in VB?
From VBA you can use only a COM object to get the CPU usage.
Read the KB on the link.. it's a start point.
How i can create a program in VB 6 that run in my Internet explorer?
hi evrybody i want to create a project in Visual Basic 6 that run in my Internet explorer.
Thanks A lot.How i can create a program in VB 6 that run in my Internet explorer?
i am not sure about VB. in Delphi their is Project by the name
Web ApplicationHow i can create a program in VB 6 that run in my Internet explorer?
Geez I used to have that... I know that they had IIS web applications (web classes) and you could use THAT if you understood the framework (pretty easy) to write pages and events etc.. and just click start and it would fire up and go. But DO NOT I repeat DO NOT use these webclasses for like real, serious work, as they suffer from a fatal flaw that cripples them in high performance / concurrency scenarios.
I think I remember there might be another type of project but then... just why not download Visual Web Developer dude? Or are you running Windows 95 or something....
Thanks A lot.How i can create a program in VB 6 that run in my Internet explorer?
i am not sure about VB. in Delphi their is Project by the name
Web ApplicationHow i can create a program in VB 6 that run in my Internet explorer?
Geez I used to have that... I know that they had IIS web applications (web classes) and you could use THAT if you understood the framework (pretty easy) to write pages and events etc.. and just click start and it would fire up and go. But DO NOT I repeat DO NOT use these webclasses for like real, serious work, as they suffer from a fatal flaw that cripples them in high performance / concurrency scenarios.
I think I remember there might be another type of project but then... just why not download Visual Web Developer dude? Or are you running Windows 95 or something....
How to refresh the controls on a vb.net form on the go?
I have a paint function which will dynamically pain ts the controls' surface.These sometime does not trigger.I don't know what's the exact problem is?
Can anybody help?????????How to refresh the controls on a vb.net form on the go?
Try control.refresh().
Make sure you are not creating an endless loop with the OnPaint event.
Maybe this will help:
http://visualbasic.about.com/od/usingvbnet/a/GDIP03.htmHow to refresh the controls on a vb.net form on the go?
Whichever method you use, if it doesn't trigger, it won;t work. You'll have to make sure that it triggers when you want it to. (The exact problem - as far as we can tell from here - is that wherever you're putting the trigger, it's not being executed every time you want it to be - IOW, it's in the wrong place.)
Can anybody help?????????How to refresh the controls on a vb.net form on the go?
Try control.refresh().
Make sure you are not creating an endless loop with the OnPaint event.
Maybe this will help:
http://visualbasic.about.com/od/usingvbnet/a/GDIP03.htmHow to refresh the controls on a vb.net form on the go?
Whichever method you use, if it doesn't trigger, it won;t work. You'll have to make sure that it triggers when you want it to. (The exact problem - as far as we can tell from here - is that wherever you're putting the trigger, it's not being executed every time you want it to be - IOW, it's in the wrong place.)
How can I put the totals of a datafield in database to my vb program?
How do i put a total of a column to a text box?
umm.im using dataenvironmentHow can I put the totals of a datafield in database to my vb program?
You should learn how to work with datareaders, datatables within your VB code.
http://www.developerfusion.com/article/4鈥?/a>
Video 12 shows how to work with sql within VB applications.
http://www.asp.net/learn/sql-videos/
umm.im using dataenvironmentHow can I put the totals of a datafield in database to my vb program?
You should learn how to work with datareaders, datatables within your VB code.
http://www.developerfusion.com/article/4鈥?/a>
Video 12 shows how to work with sql within VB applications.
http://www.asp.net/learn/sql-videos/
In VB how can you make the program count up every time you click a box?
I need the command to make the computer count for me. it's a project involving albums and i need a display counter showing how many albums i've clicked on so far. Does that make sense? So like click one, it says 1. click a second it will say 2, but i have to make it so you can click them in any order not in the order they are presented.In VB how can you make the program count up every time you click a box?
Simple, just like this:
Dim x As New Random()
For I As Int32 = 0 To 20
Dim y As Double = (x.Next(1, 1000) / 1000)
Me.CheckedListBox1.Items. Add(y, y %26lt; 0.5)
Next
Me.Text = Me.CheckedListBox1. CheckedItems. CountIn VB how can you make the program count up every time you click a box?
Use a label or a text box to store the incremented value...in the onclick event for each picture or button, set the incrementation up.
Simple, just like this:
Dim x As New Random()
For I As Int32 = 0 To 20
Dim y As Double = (x.Next(1, 1000) / 1000)
Me.CheckedListBox1.Items. Add(y, y %26lt; 0.5)
Next
Me.Text = Me.CheckedListBox1. CheckedItems. CountIn VB how can you make the program count up every time you click a box?
Use a label or a text box to store the incremented value...in the onclick event for each picture or button, set the incrementation up.
How do you remove a single item from a List Box in VB.net?
I tried ';ListBox1.Items.Remove([thing to remove])'; but that didn't work. Any suggestions?How do you remove a single item from a List Box in VB.net?
Try this ..
ListBox1.Items.RemoveAt(index # of the item)
Of cause this needs to be within a event .. eg :: Button ClickHow do you remove a single item from a List Box in VB.net?
ListBox.ClearSelected() should do it.
Try this ..
ListBox1.Items.RemoveAt(index # of the item)
Of cause this needs to be within a event .. eg :: Button ClickHow do you remove a single item from a List Box in VB.net?
ListBox.ClearSelected() should do it.
How do you generate integers in VB?
More specifically I need to generate 50 random integers in 1 textbox. I figured out how to generate one, but not 50. Any help appreciated!How do you generate integers in VB?
dim iRnd(50) as integer
sub rndSub
' Initialize the random-number generator.
Randomize()
' Generate random value between 1 and 100.
Dim value As Integer
dim i as integer
for i = 0 to 49
iRnd(i) = (Int((100 * Rnd()) + 1) ' iRnd is global, so after exiting the sub you can access it
next i
end subHow do you generate integers in VB?
You'll need to use an array. Sorry, I don't know VB syntax (thank goodness). I think they use something called ';dim';. But I advise anyone using VB to stop immediately and switch to something like C++, C# or Java (all are free). But, if you really need to know this, Google is your friend. Search for ';VB array';, ';Visual Basic array'; or ';Visual Basic dim';. HTH
dim iRnd(50) as integer
sub rndSub
' Initialize the random-number generator.
Randomize()
' Generate random value between 1 and 100.
Dim value As Integer
dim i as integer
for i = 0 to 49
iRnd(i) = (Int((100 * Rnd()) + 1) ' iRnd is global, so after exiting the sub you can access it
next i
end subHow do you generate integers in VB?
You'll need to use an array. Sorry, I don't know VB syntax (thank goodness). I think they use something called ';dim';. But I advise anyone using VB to stop immediately and switch to something like C++, C# or Java (all are free). But, if you really need to know this, Google is your friend. Search for ';VB array';, ';Visual Basic array'; or ';Visual Basic dim';. HTH
How to delete multiple selected rows in a Data Grid View in vb.net?
I'm having a datagridview with 5 rows. I have to delete the selected rows. How to do this. Any idea?How to delete multiple selected rows in a Data Grid View in vb.net?
For each objRow as DataGridViewRow in objMyGrid.SelectedRows
objRow.Remove()
NextHow to delete multiple selected rows in a Data Grid View in vb.net?
Update: Just had to do this myself today and found a much quicker method using one line:
MyDataGridViewObject.Rows.Cl鈥?PDA
For each objRow as DataGridViewRow in objMyGrid.SelectedRows
objRow.Remove()
NextHow to delete multiple selected rows in a Data Grid View in vb.net?
Update: Just had to do this myself today and found a much quicker method using one line:
MyDataGridViewObject.Rows.Cl鈥?
Report Abuse
How do I take a .vb file and compile it in visual studio 8?
I have a couple of source files I want to edit and compile but when I double click on them its just like having it in a text editor. How can I change this to test/compile the program????How do I take a .vb file and compile it in visual studio 8?
You have to create a VB project and then add the files to that project.
1) Project | New -%26gt; select VB and then the type of project you need
2) Place the files into the project folder
3) Add the files to the project through Project | Add Existing ItemHow do I take a .vb file and compile it in visual studio 8?
click RUN
Right click with mouse on the file and say open with Visual studio 8.
You have to create a VB project and then add the files to that project.
1) Project | New -%26gt; select VB and then the type of project you need
2) Place the files into the project folder
3) Add the files to the project through Project | Add Existing ItemHow do I take a .vb file and compile it in visual studio 8?
click RUN
Right click with mouse on the file and say open with Visual studio 8.
How to make an alarm in vb 2005?
I need to create a simple alarm using vb 2005.
Anyone could just post the code and i will try it.
If it works, i will vote it as best answer.
Thank you!How to make an alarm in vb 2005?
Is this a time-based alarm? If so, just use a Timer component and subscribe to it's Tick event. In the Tick event handler, perform whatever action you require.How to make an alarm in vb 2005?
What do you mean by alarm?
VB uses MsgBox
MsgBox(prompt[, buttons][, title][, helpfile, context])
# 0 = vbOKOnly - OK button only
# 1 = vbOKCancel - OK and Cancel buttons
# 2 = vbAbortRetryIgnore - Abort, Retry, and Ignore buttons
# 3 = vbYesNoCancel - Yes, No, and Cancel buttons
# 4 = vbYesNo - Yes and No buttons
# 5 = vbRetryCancel - Retry and Cancel buttons
# 16 = vbCritical - Critical Message icon
# 32 = vbQuestion - Warning Query icon
# 48 = vbExclamation - Warning Message icon
# 64 = vbInformation - Information Message icon
Anyone could just post the code and i will try it.
If it works, i will vote it as best answer.
Thank you!How to make an alarm in vb 2005?
Is this a time-based alarm? If so, just use a Timer component and subscribe to it's Tick event. In the Tick event handler, perform whatever action you require.How to make an alarm in vb 2005?
What do you mean by alarm?
VB uses MsgBox
MsgBox(prompt[, buttons][, title][, helpfile, context])
# 0 = vbOKOnly - OK button only
# 1 = vbOKCancel - OK and Cancel buttons
# 2 = vbAbortRetryIgnore - Abort, Retry, and Ignore buttons
# 3 = vbYesNoCancel - Yes, No, and Cancel buttons
# 4 = vbYesNo - Yes and No buttons
# 5 = vbRetryCancel - Retry and Cancel buttons
# 16 = vbCritical - Critical Message icon
# 32 = vbQuestion - Warning Query icon
# 48 = vbExclamation - Warning Message icon
# 64 = vbInformation - Information Message icon
What type of Variable should be initialized for comparing Degree:Min:Sec - In VB?
I need to compare astrological data in degree:min:sec what type of variable should i define in VB6?
For example - If degree %26gt;=030:00:00 and degree%26lt;=:059:59:59
how can i code this in VB6? Thank you in advance for the answers.What type of Variable should be initialized for comparing Degree:Min:Sec - In VB?
There are a couple of ways to do this.
First, you could store all that information as a long int as,
bits 1 - 6 : seconds
bits 7 - 12: minutes
bits 13 - 32 : degrees (more bits than you need, but it's what is there)
This way, the comparisons would be exactly as you have written, but accessing and setting the particular pieces of the data would be more difficult (require bitwise operations)
The more likely way to accomplish this would be to define a coordinate object that stores three ints (or shorts), representing seconds, minutes and degrees, and a compareTo that compares first degrees, then (if they are equal) minutes, then seconds.
For example - If degree %26gt;=030:00:00 and degree%26lt;=:059:59:59
how can i code this in VB6? Thank you in advance for the answers.What type of Variable should be initialized for comparing Degree:Min:Sec - In VB?
There are a couple of ways to do this.
First, you could store all that information as a long int as,
bits 1 - 6 : seconds
bits 7 - 12: minutes
bits 13 - 32 : degrees (more bits than you need, but it's what is there)
This way, the comparisons would be exactly as you have written, but accessing and setting the particular pieces of the data would be more difficult (require bitwise operations)
The more likely way to accomplish this would be to define a coordinate object that stores three ints (or shorts), representing seconds, minutes and degrees, and a compareTo that compares first degrees, then (if they are equal) minutes, then seconds.
Generate a list of installed programs to Access using VB script?
Hi,
I am trying to generate a list of programs that appear in my Add/Remove Programs list and create a list of these programs in Access. I have the script which generates a list to Excel but want to change it to Access. I am using VB.
Can anyone help me figure out how to change it?
Thanks.Generate a list of installed programs to Access using VB script?
Why not just link the Excel spreadsheet to your Access database?Generate a list of installed programs to Access using VB script?
This shows you how to get the list and put it into a list control, it'll show you how to get the list itself.
http://www.tek-tips.com/viewthread.cfm?q鈥?/a>
To get it into Access you'll need to create and Access database with an appropriate table.
This page discusses how to use an Access Database from VB.http://www.vbexplorer.com/VBExplorer/vb_鈥?/a>
Retrieve the list of programs from the registry and store them in an array, say strMyPrograms(100). Then open an ADO recordset using ADO Connection and Command variables and the table name. Then loop through your array and use recordset.AddNew to save them to your Access table.
For i=1 to intNumberOfPrograms
rs.AddNew
rs.fields(';ProgramName';)=strMyPrograms鈥?br>
rs.Update
Next i
I am trying to generate a list of programs that appear in my Add/Remove Programs list and create a list of these programs in Access. I have the script which generates a list to Excel but want to change it to Access. I am using VB.
Can anyone help me figure out how to change it?
Thanks.Generate a list of installed programs to Access using VB script?
Why not just link the Excel spreadsheet to your Access database?Generate a list of installed programs to Access using VB script?
This shows you how to get the list and put it into a list control, it'll show you how to get the list itself.
http://www.tek-tips.com/viewthread.cfm?q鈥?/a>
To get it into Access you'll need to create and Access database with an appropriate table.
This page discusses how to use an Access Database from VB.http://www.vbexplorer.com/VBExplorer/vb_鈥?/a>
Retrieve the list of programs from the registry and store them in an array, say strMyPrograms(100). Then open an ADO recordset using ADO Connection and Command variables and the table name. Then loop through your array and use recordset.AddNew to save them to your Access table.
For i=1 to intNumberOfPrograms
rs.AddNew
rs.fields(';ProgramName';)=strMyPrograms鈥?br>
rs.Update
Next i
In VB.net, how can I check to see if the changes made to a datagrid cell are valid before committing the edit?
One of the cells of the datagrid is numeric data only. If the user enters any other character, an error occurs but I have no place to catch the exception. I know there must be a way to do it within the mydatagrid_cellendedit but I can't seem to figure it out. Any help would be greatly appreciated.In VB.net, how can I check to see if the changes made to a datagrid cell are valid before committing the edit?
Hello. Like the gentleman above I have not used datagrids to update data in a while. I beg your pardon if my syntax is incorrect, but I imagine if you play around for a while you can get it. I also am assuming you're creating a windows application. Can you please specify what you are using to develop? Visual Studio 2003/2005, web matrix?
I imagine if there is some server side event being called when you leave the cell, could be something like myDataGrid_ItemUpdated something like that. On that event you could check the value of the cell to see if it's numeric and then if it's not just set a label saying only numeric values allowed.
*Update: Just spent a little bit of time looking at this. Hope this helps. It's done using VS 2005. By the way I was forced to put spaces at the end of lines so it would show up in the forum. Let me know if you have any other questions.
Private Sub DataGridView1_CellValueChanged(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEve鈥?Handles DataGridView1.CellValueChanged
If e.RowIndex %26gt;= 0 Then
Try
'if you can convert the cell to a number then it is a number
'0 is the cell that you would want to be checking for a number
Dim intPlaceHolder As Integer = CType(DataGridView1.Rows(e.Row
Index).Cells(0).Value.ToString (), Integer)
lblError.Text = ';fine';
Catch ex As Exception
lblError.Text = ';Not Fine';
Exit Sub
End Try
End If
End SubIn VB.net, how can I check to see if the changes made to a datagrid cell are valid before committing the edit?
Hmmm.... I don't have access to .Net right now, and it's been a while since I worked with datagrids in it. Is the error presenting as soon as you enter the data, or after you take some kind of action? If an error is being generated when you take an action, like clicking a button, you may be able to find out the exact error number (can't remember how to do it offhand in VB..something like 'Err.Message') and put a catch in for that specific error, prompting the user to enter a numerical value. If it is happening when entering into the datagrid, then you may want to prevent anyone from entering values directly into the grid, and instead have them enter them in a form, where you can validate them, then pass the values along to the datagrid. Hope this helps - good luck.
Hello. Like the gentleman above I have not used datagrids to update data in a while. I beg your pardon if my syntax is incorrect, but I imagine if you play around for a while you can get it. I also am assuming you're creating a windows application. Can you please specify what you are using to develop? Visual Studio 2003/2005, web matrix?
I imagine if there is some server side event being called when you leave the cell, could be something like myDataGrid_ItemUpdated something like that. On that event you could check the value of the cell to see if it's numeric and then if it's not just set a label saying only numeric values allowed.
*Update: Just spent a little bit of time looking at this. Hope this helps. It's done using VS 2005. By the way I was forced to put spaces at the end of lines so it would show up in the forum. Let me know if you have any other questions.
Private Sub DataGridView1_CellValueChanged(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEve鈥?Handles DataGridView1.CellValueChanged
If e.RowIndex %26gt;= 0 Then
Try
'if you can convert the cell to a number then it is a number
'0 is the cell that you would want to be checking for a number
Dim intPlaceHolder As Integer = CType(DataGridView1.Rows(e.Row
Index).Cells(0).Value.ToString (), Integer)
lblError.Text = ';fine';
Catch ex As Exception
lblError.Text = ';Not Fine';
Exit Sub
End Try
End If
End SubIn VB.net, how can I check to see if the changes made to a datagrid cell are valid before committing the edit?
Hmmm.... I don't have access to .Net right now, and it's been a while since I worked with datagrids in it. Is the error presenting as soon as you enter the data, or after you take some kind of action? If an error is being generated when you take an action, like clicking a button, you may be able to find out the exact error number (can't remember how to do it offhand in VB..something like 'Err.Message') and put a catch in for that specific error, prompting the user to enter a numerical value. If it is happening when entering into the datagrid, then you may want to prevent anyone from entering values directly into the grid, and instead have them enter them in a form, where you can validate them, then pass the values along to the datagrid. Hope this helps - good luck.
Simple VB Excel Question - How do I find and delete any row that contains the word ';total';?
I've created a macro for Excel in Visual Basic and I need to modify it to find and delete any row that contains the word ';total.';
I also need to make sure the macro doesn't bug out if the word ';total'; doesn't exist on the page.Simple VB Excel Question - How do I find and delete any row that contains the word ';total';?
Sub Delete_Totals()
'
' Delete_Totals Macro
' Macro recorded 12/24/2008
'
On Error GoTo Err
For x = 1 To 100
Cells.Find(What:=';total';, _
After:=Range(';A1';), _
LookIn:=xlFormulas, _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False) _
.EntireRow.Delete
Next
Err:
End SubSimple VB Excel Question - How do I find and delete any row that contains the word ';total';?
I need to see that macro to tell how to modify it the way you want
Enjoy my profile, VBAXLMan is back
I also need to make sure the macro doesn't bug out if the word ';total'; doesn't exist on the page.Simple VB Excel Question - How do I find and delete any row that contains the word ';total';?
Sub Delete_Totals()
'
' Delete_Totals Macro
' Macro recorded 12/24/2008
'
On Error GoTo Err
For x = 1 To 100
Cells.Find(What:=';total';, _
After:=Range(';A1';), _
LookIn:=xlFormulas, _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False) _
.EntireRow.Delete
Next
Err:
End SubSimple VB Excel Question - How do I find and delete any row that contains the word ';total';?
I need to see that macro to tell how to modify it the way you want
Enjoy my profile, VBAXLMan is back
Tuesday, November 16, 2010
How do i make a Language Translator on anytype of language, C++, VB, Java, Etc.?
I need to make a translator to translate a cipher laguage me and my freind created, how do i make a translator??How do i make a Language Translator on anytype of language, C++, VB, Java, Etc.?
You have made a cipher language with what they call bindings for each letter of the alphabet.
Let's take an example for the old Ceasar cipher. This cipher was created by Julius ceasar and is pretty basic. It just moves the alphabet a certain amount of numbers to the left. So let's say the number it moves is 2.
If you type in C in the code, it would be translated as an A. A being 2 letter behind C, or A + 2 = C, or C - 2 = A.
Hopefully you get that, because I will work for that example.
So if you were to implement the Ceasar cipher, you would create a list, or array of the alphabet.
static char ALPHABET[] = {'A', 'B', 'C', 'D', etc};
Then you would get the code you want to decipher. So just say it said something like ';FCJJM UNPJB'; which in English would be ';HELLO WORLD';
So, you would go through the string ';FCJJM UNPJB'; changing every letter to the letter it should be.
In Java you would do something like this.
char deciphered = word.toCharArray();
for (int i = 0; i %26lt; word.length(); i++) // where word is the string
int charValue = (int) deciphered[i] - 97; // minus 97 as the ASCII code for A is 97.
Now, you would want to find out if the charValue is below 2. If it is, you would add 26 - 2 to the charvalue to get the next letter.
For example, A would be 0, and you want to get 24, which is Y.
B would be 1, and you would get 25, which is Z.
If the charValue is 2 or above, you would just minus 2 from the charValue. C (2) would give you A (0).
if (charValue %26lt; 2)
charValue = charValue + 26 - 2;
else
charValue = charValue - 2;
Then change the char in deciphered.
deciphered[i] = ALPHABET[charValue];
} // end for loop
Ok, to get back to your example. if your code does not change, and you know that A refers to an S always, and B refers to an F always, you could do something like this.
Create an array of the alphabet as above.
Create another array of the letters that are for the letters of the alphabet.
static char CODE = {'S', 'F', etc};
The do the same for loop as above, but this time instead of changing the value of the charValue to -2 etc, do this.
deciphered[i] = CODE[ ALPHABET[ charValue ]];
Hope that is understandable. If not click on my profile and email me and I can explain more.How do i make a Language Translator on anytype of language, C++, VB, Java, Etc.?
That may be extremely hard. You have to find the patterns in the differences between the languages. Also, it is partially impossible b/c the different languages have different features, which means that there are things in Java that is not present in C++, so things may be lost.
You have made a cipher language with what they call bindings for each letter of the alphabet.
Let's take an example for the old Ceasar cipher. This cipher was created by Julius ceasar and is pretty basic. It just moves the alphabet a certain amount of numbers to the left. So let's say the number it moves is 2.
If you type in C in the code, it would be translated as an A. A being 2 letter behind C, or A + 2 = C, or C - 2 = A.
Hopefully you get that, because I will work for that example.
So if you were to implement the Ceasar cipher, you would create a list, or array of the alphabet.
static char ALPHABET[] = {'A', 'B', 'C', 'D', etc};
Then you would get the code you want to decipher. So just say it said something like ';FCJJM UNPJB'; which in English would be ';HELLO WORLD';
So, you would go through the string ';FCJJM UNPJB'; changing every letter to the letter it should be.
In Java you would do something like this.
char deciphered = word.toCharArray();
for (int i = 0; i %26lt; word.length(); i++) // where word is the string
int charValue = (int) deciphered[i] - 97; // minus 97 as the ASCII code for A is 97.
Now, you would want to find out if the charValue is below 2. If it is, you would add 26 - 2 to the charvalue to get the next letter.
For example, A would be 0, and you want to get 24, which is Y.
B would be 1, and you would get 25, which is Z.
If the charValue is 2 or above, you would just minus 2 from the charValue. C (2) would give you A (0).
if (charValue %26lt; 2)
charValue = charValue + 26 - 2;
else
charValue = charValue - 2;
Then change the char in deciphered.
deciphered[i] = ALPHABET[charValue];
} // end for loop
Ok, to get back to your example. if your code does not change, and you know that A refers to an S always, and B refers to an F always, you could do something like this.
Create an array of the alphabet as above.
Create another array of the letters that are for the letters of the alphabet.
static char CODE = {'S', 'F', etc};
The do the same for loop as above, but this time instead of changing the value of the charValue to -2 etc, do this.
deciphered[i] = CODE[ ALPHABET[ charValue ]];
Hope that is understandable. If not click on my profile and email me and I can explain more.How do i make a Language Translator on anytype of language, C++, VB, Java, Etc.?
That may be extremely hard. You have to find the patterns in the differences between the languages. Also, it is partially impossible b/c the different languages have different features, which means that there are things in Java that is not present in C++, so things may be lost.
How come I can't make a simple .exe file in visual basic express edition 2008 like in vb 6?
When I publish the program, I get a whole set of files. And when I try to run the program in another machine, I get a message asking me to install the .NET framework! Can't I just make a simple .exe so that I can run it without spending about 1hour downloading .NET?How come I can't make a simple .exe file in visual basic express edition 2008 like in vb 6?
Once you get to VS 2008 then VB is only a .NET environment - you cannot create a standalone VB program like that (or not easily anyway). MS decided to do that because once you get to Vista and Windows 7 the .NET framework will be already available to the user.How come I can't make a simple .exe file in visual basic express edition 2008 like in vb 6?
When you build or run an application, the EXE is automatically created and placed in the MyProject/MyProject/bin/Debug folder. So if your application is called Fish and you chose to save in the C drive, the folder the EXE is in is C:\Fish\Fish\bin\Debug.
You can run the EXE anywhere as long as the target computer has the version of the .Net framework that your application is using. Most computers nowadays have this, so you don't have to worry much. So .Net will have to be installed, but your application won't need to be.
You can't do that in VB6 either. You need any controls you add to the program, and you need the VB6 runtime installed. The exe calls library routines in msvbvm60.dll in VB6 or .net in VB.net. If you copy the exe from a VB6 project to a computer without the runtime or one of the controls, you'll get an error when you try to run it. (Since the runtime and most of the controls are part of XP, most people who aren't familiar with early versions of Windows have never run into the problem. But if you write a VB6 program using Office controls, and install it on a computer that doesn't have Office, it won't work either.)
VB 2008 runs off the .NET framework, and any program you compile will require .NET. Why do you think it would take an entire hour downloading .NET? Perhaps you need a faster connection. Modems are painfully slow.
If I remember correctly, there is an option to allow the compiled ZIP file contain everything the end user needs (including any DLLs, .NET, and anything else the program would require.) I don't remember where that option is, but I'm fairly certain it's there somewhere.
VB6 isn't that simple anyway, it does have dependency to msvbvm60.dll
and not even C/C++ (that is compiled from Visual Studio, other compiler may vary) are free from msvcrt,dll (Microsoft Visual C Runtime)
only they are included in the newer version of Windows
since .NET was released after XP, it does not have .NET runtime by default...
There will be a compiled version of the program genereted each time you test it in Visual Basic. Just go to your My Documents\Visual Studio 2008\Projects\*Whatever Your Program's Called*\*Whatever Your Program's Called*\bin\Release\*Program*.exe
Once you get to VS 2008 then VB is only a .NET environment - you cannot create a standalone VB program like that (or not easily anyway). MS decided to do that because once you get to Vista and Windows 7 the .NET framework will be already available to the user.How come I can't make a simple .exe file in visual basic express edition 2008 like in vb 6?
When you build or run an application, the EXE is automatically created and placed in the MyProject/MyProject/bin/Debug folder. So if your application is called Fish and you chose to save in the C drive, the folder the EXE is in is C:\Fish\Fish\bin\Debug.
You can run the EXE anywhere as long as the target computer has the version of the .Net framework that your application is using. Most computers nowadays have this, so you don't have to worry much. So .Net will have to be installed, but your application won't need to be.
You can't do that in VB6 either. You need any controls you add to the program, and you need the VB6 runtime installed. The exe calls library routines in msvbvm60.dll in VB6 or .net in VB.net. If you copy the exe from a VB6 project to a computer without the runtime or one of the controls, you'll get an error when you try to run it. (Since the runtime and most of the controls are part of XP, most people who aren't familiar with early versions of Windows have never run into the problem. But if you write a VB6 program using Office controls, and install it on a computer that doesn't have Office, it won't work either.)
VB 2008 runs off the .NET framework, and any program you compile will require .NET. Why do you think it would take an entire hour downloading .NET? Perhaps you need a faster connection. Modems are painfully slow.
If I remember correctly, there is an option to allow the compiled ZIP file contain everything the end user needs (including any DLLs, .NET, and anything else the program would require.) I don't remember where that option is, but I'm fairly certain it's there somewhere.
VB6 isn't that simple anyway, it does have dependency to msvbvm60.dll
and not even C/C++ (that is compiled from Visual Studio, other compiler may vary) are free from msvcrt,dll (Microsoft Visual C Runtime)
only they are included in the newer version of Windows
since .NET was released after XP, it does not have .NET runtime by default...
There will be a compiled version of the program genereted each time you test it in Visual Basic. Just go to your My Documents\Visual Studio 2008\Projects\*Whatever Your Program's Called*\*Whatever Your Program's Called*\bin\Release\*Program*.exe
How can you multiply arrays in vb?
I want to know how to multiply two 2-d arrays using visual basic, and if possible, to check if they can be multiplied in the first place.
ThanksHow can you multiply arrays in vb?
You have to use loops and do it all manually. VB doesn't have a multiply array function like a few other versions of BASIC.
Shadow Wolf
ThanksHow can you multiply arrays in vb?
You have to use loops and do it all manually. VB doesn't have a multiply array function like a few other versions of BASIC.
Shadow Wolf
Does anyone know how to make your browser auto re size in VB 08 when stretched around?
im making my own personal browser in visual basic 08 and i have everything done but how to do that. when i go to stretch it out or shrink it it stays in one area and doesn't auto re size.Does anyone know how to make your browser auto re size in VB 08 when stretched around?
You need to dock it in the form, or set it's anchors to all four sides. This can be done in development, through the properties tab, or during run time when you load the form.in the past my pc
You need to dock it in the form, or set it's anchors to all four sides. This can be done in development, through the properties tab, or during run time when you load the form.
Importing data to a form in VB from an online database?
I'd love to know of any sources of information, or tips/tricks/ideas as of how this is done.
I have an online SQL/Access database (w/e), and I'd love to load this information in a Form (an actual .exe application).
Could someone tell me how this can be done?
Thank you.Importing data to a form in VB from an online database?
You should be able to define your database to VB (probably via ODBC connectivity) and then specify it as a data source to a datagrid or other similar widget.
I have an online SQL/Access database (w/e), and I'd love to load this information in a Form (an actual .exe application).
Could someone tell me how this can be done?
Thank you.Importing data to a form in VB from an online database?
You should be able to define your database to VB (probably via ODBC connectivity) and then specify it as a data source to a datagrid or other similar widget.
How to insert textbox values into database using VB 2005.?
I have to insert text box values into a database using VB 2005 application.How to insert textbox values into database using VB 2005.?
you can use ado.net
it's too late for me to type it out, but look at this link:
http://www.vbdotnetheaven.com/UploadFile鈥?/a>
basically open a connection
create a sql string and execute it ... I think you can just go connection.execute (strSQL)
you can use ado.net
it's too late for me to type it out, but look at this link:
http://www.vbdotnetheaven.com/UploadFile鈥?/a>
basically open a connection
create a sql string and execute it ... I think you can just go connection.execute (strSQL)
How to use set the date of a DateTimePicker object in vb.net to today's date?
I want a button that will set a few different dates in 2 different date time pickers (from and to)
Today, Month to Date, Year to Date, Last Month and Last Year
How do I format the variable to set the date time picker = to, and how would i get today's current date from teh system clock?How to use set the date of a DateTimePicker object in vb.net to today's date?
DateTime.Now
Today, Month to Date, Year to Date, Last Month and Last Year
How do I format the variable to set the date time picker = to, and how would i get today's current date from teh system clock?How to use set the date of a DateTimePicker object in vb.net to today's date?
DateTime.Now
How to make a VB program order a keyboard actions?
How can I make it so that my code orders a user to press a key?
As in, it order's him/her to press the B key.
Also, how do I make it so that it makes him/her click left click?How to make a VB program order a keyboard actions?
If you want to capture just the fact that the mouse was clicked, you listen for the click event in a form or a control. The click event is fired if the form or control was clicked.
If you want to force someone to enter a specific character, you can use a boolean, a while and a prompt.
Dim myBool As Boolean = False
Dim myChar As String = ';';
While myBool = False
myChar = InputBox( ';Enter the letter B and click OK.';)
If myChar = ';B'; Then
myBool = True
End If
Loop
As in, it order's him/her to press the B key.
Also, how do I make it so that it makes him/her click left click?How to make a VB program order a keyboard actions?
If you want to capture just the fact that the mouse was clicked, you listen for the click event in a form or a control. The click event is fired if the form or control was clicked.
If you want to force someone to enter a specific character, you can use a boolean, a while and a prompt.
Dim myBool As Boolean = False
Dim myChar As String = ';';
While myBool = False
myChar = InputBox( ';Enter the letter B and click OK.';)
If myChar = ';B'; Then
myBool = True
End If
Loop
How to add line number to textbox or richtextbox in VB 2008 Exp?
how to add line number to textbox or richtextbox just like they do in html editor? Thanks in advance for any useful advise. I will pick the best answer.How to add line number to textbox or richtextbox in VB 2008 Exp?
You may want to make a user control. Put a textbox or richtext on one size and either draw the row numbers in the paint event or use a label on the other side.
You may want to make a user control. Put a textbox or richtext on one size and either draw the row numbers in the paint event or use a label on the other side.
How to search a record in VB 6 ado?
I have linked my access database in VB using ado. The records show in the listbox named lstrecords. I want to be able to type in a keyword in the text box and when i click the search button, i want the results to be displayed in the listbox. I dnt mind if the whole table gets searched or just one field. Can anybody help? thanksHow to search a record in VB 6 ado?
If the text box is called txtKeyWord, on form YourForm, then in the SearchButton OnCLick event handler, create a dynamic SQL statement: the aim is to produce the criteria
Is Like ';*keyword*';
strSQL = SELECT fields, etc FROM Table WHERE (FieldName Is Like '*'; %26amp; Forms![YourForm]!txtKeyWord] %26amp; ';*');';
etcHow to search a record in VB 6 ado?
Select %26lt;the field you want to display%26gt; from %26lt;the table name%26gt; where %26lt;the field to be searched%26gt; = '%26lt;the input from the user%26gt;';
Open the recordset with that string (build it from the user input) and display the resulting records.
If the text box is called txtKeyWord, on form YourForm, then in the SearchButton OnCLick event handler, create a dynamic SQL statement: the aim is to produce the criteria
Is Like ';*keyword*';
strSQL = SELECT fields, etc FROM Table WHERE (FieldName Is Like '*'; %26amp; Forms![YourForm]!txtKeyWord] %26amp; ';*');';
etcHow to search a record in VB 6 ado?
Select %26lt;the field you want to display%26gt; from %26lt;the table name%26gt; where %26lt;the field to be searched%26gt; = '%26lt;the input from the user%26gt;';
Open the recordset with that string (build it from the user input) and display the resulting records.
How to make random pictures appear on the picturebox in VB 2005 Express?
Microsoft visual basic 2005 Express.
how to make random pictures appear in the picture box?
What is the code??
It's for the design in my project. ^_^
Is it possible? I want random pictures appear on it.
Example, there are five pictures i want to be displayed in the picturebox in random. how??How to make random pictures appear on the picturebox in VB 2005 Express?
One way of doing it is:
First you need to generate random numbers from 1 to 5 and store the value in an integer variable. Then all you have to do is use a swicth case in a timer object. Set the timer object to execute as often as you want the pictures to change,
i.e.
switch (randomNum)
{
case 1:
picBox.picture(';Picture1';)
break
case 2:
picBox.picture(';Picture2';)
break
etc...
}
This is pseudocode but you get the point!How to make random pictures appear on the picturebox in VB 2005 Express?
You would need an array with the path to all your pics. EG:
Public picArr (1 to 4) as string
Public PicCount as integer
Private Sub Form_Load()
picArr(1)=';c:/me.jpg';
picArr(2)=';c:/myDog.jpg';
picArr(3)=';c:/Airport.jpg';
picArr(4)=';c:/pics/Madagascar.jpg';
PicCount=4
End Sub
Public Sub ChangePicture ()
dim x as decimal
x=rand(Now())
x=x*(picCount-1)
x=x+1
picBox1.picture=openpicture (picArr(cint(x)))
end sub
I think that's right... I stand to be corrected.
Hope you get it right,
Matt :)
how to make random pictures appear in the picture box?
What is the code??
It's for the design in my project. ^_^
Is it possible? I want random pictures appear on it.
Example, there are five pictures i want to be displayed in the picturebox in random. how??How to make random pictures appear on the picturebox in VB 2005 Express?
One way of doing it is:
First you need to generate random numbers from 1 to 5 and store the value in an integer variable. Then all you have to do is use a swicth case in a timer object. Set the timer object to execute as often as you want the pictures to change,
i.e.
switch (randomNum)
{
case 1:
picBox.picture(';Picture1';)
break
case 2:
picBox.picture(';Picture2';)
break
etc...
}
This is pseudocode but you get the point!How to make random pictures appear on the picturebox in VB 2005 Express?
You would need an array with the path to all your pics. EG:
Public picArr (1 to 4) as string
Public PicCount as integer
Private Sub Form_Load()
picArr(1)=';c:/me.jpg';
picArr(2)=';c:/myDog.jpg';
picArr(3)=';c:/Airport.jpg';
picArr(4)=';c:/pics/Madagascar.jpg';
PicCount=4
End Sub
Public Sub ChangePicture ()
dim x as decimal
x=rand(Now())
x=x*(picCount-1)
x=x+1
picBox1.picture=openpicture (picArr(cint(x)))
end sub
I think that's right... I stand to be corrected.
Hope you get it right,
Matt :)
Buy a book on Excel VBA or simply learn to write VB?
I consider myself an expert in excel but in order to make some things I do easier, I record macros. I am handicapped when recording because I don't fully understand VB and I have to start over whenever I make a small error. Is it better to simply learn how to write Visual Basic or should I buy a book that teach you VBA programming with excel? I am leaning towards completely learning visual basic but don't want this to be a waste of time.Buy a book on Excel VBA or simply learn to write VB?
I'd say if your serious about macros etc... and use Excel a lot then learning VB would be a worthwhile thing to do. Not only can you write things for Excel but you can write complete programs using VB. Also if you use Access quite a bit VB comes in mighty handy.
Most of the people I know who use Excel know VB inside out and end up designing programs using VB too. The added bonus means you could get a better job out of it.
I'd say if your serious about macros etc... and use Excel a lot then learning VB would be a worthwhile thing to do. Not only can you write things for Excel but you can write complete programs using VB. Also if you use Access quite a bit VB comes in mighty handy.
Most of the people I know who use Excel know VB inside out and end up designing programs using VB too. The added bonus means you could get a better job out of it.
How to Setup a wait for my code on vb 2008?
Ok I have Visual Basics 2008 and I need a wait code setup to work with this new program I am creating here is the basics:
SendKeys.Send(';Message';)
Wait 2 seconds
SendKeys.Send(';2nd message in the next textbox';)
Wait 2 seconds
SendKeys.Send(';3rd Message in the 3rd textbox';)
Any help is much appreciated and if you need anymore detail please ask.How to Setup a wait for my code on vb 2008?
threading.thread.sleep(2000)
this will pause the thread for 2 secondsHow to Setup a wait for my code on vb 2008?
Use the timer. Set timer to run every 2 seconds. In the timer, call SendKeys. You will need to keep track of what you need to send next. You could use a counter variable that you increment each time in the timer routine. Then either switch on the counter variable, or use it to index an array to figure out what to send next.
HTH
SendKeys.Send(';Message';)
Wait 2 seconds
SendKeys.Send(';2nd message in the next textbox';)
Wait 2 seconds
SendKeys.Send(';3rd Message in the 3rd textbox';)
Any help is much appreciated and if you need anymore detail please ask.How to Setup a wait for my code on vb 2008?
threading.thread.sleep(2000)
this will pause the thread for 2 secondsHow to Setup a wait for my code on vb 2008?
Use the timer. Set timer to run every 2 seconds. In the timer, call SendKeys. You will need to keep track of what you need to send next. You could use a counter variable that you increment each time in the timer routine. Then either switch on the counter variable, or use it to index an array to figure out what to send next.
HTH
Can anyone help me make an installer in VB 2008?
I just need to how to add my files and know the command code for extracting files and putting it into a specific place. I also need to make it so that the users can鈥檛 change the installation directory.Can anyone help me make an installer in VB 2008?
If you go to the build menu and hit publish it will make an installer for you.
If that doesn't work for you, you could use a .zip for distributing your program.4save marriage
If you go to the build menu and hit publish it will make an installer for you.
If that doesn't work for you, you could use a .zip for distributing your program.
Can anyone help me make an installer in VB 2008?
I just need to how to add my files and know the command code for extracting files and putting it into a specific place. I also need to make it so that the users can鈥檛 change the installation directory.Can anyone help me make an installer in VB 2008?
If you go to the build menu and hit publish it will make an installer for you.
If that doesn't work for you, you could use a .zip for distributing your program.
If you go to the build menu and hit publish it will make an installer for you.
If that doesn't work for you, you could use a .zip for distributing your program.
How do I refresh a subform in Access 2003 using VB?
I have a form with two subforms, I want update one of the subform with a new row (subform in dataheet view) with data entered into a second subform(form view). The update happens, but the new row does not appear on the subform that is in datasheet view. If I set the focus to that sub form and press shift F9 the form will update. So asking if there is a way to make this happen automatically using vb?How do I refresh a subform in Access 2003 using VB?
Yes, there is a way:
In the second subform that you use to enter data, go to properties, and create event procedure for event ';After Update';. Then insert the following command into created sub:
Forms![MainFormName].Refresh
Make sure to place actual form name instead of MainFormName, but keep the square brackets.
Yes, there is a way:
In the second subform that you use to enter data, go to properties, and create event procedure for event ';After Update';. Then insert the following command into created sub:
Forms![MainFormName].Refresh
Make sure to place actual form name instead of MainFormName, but keep the square brackets.
We have the database of Access in 1 network and front-end of VB to totally in another network? how to connect?
If connection is possible then how to configure it?We have the database of Access in 1 network and front-end of VB to totally in another network? how to connect?
Simply put, if you have all administrative rights and permissions, you should probably use a tunnel to bridge the 2 networks and place the Access database on a shared drive.
Note that I absolutely don't recommend this as it will be slow as hell and Access is not a database server, so don't count on it to perform at all.
A real solution would be to convert your Access DB to a real DB server like Oracle, Informix, MySQL or other similar products and use ODBC from your VB program.We have the database of Access in 1 network and front-end of VB to totally in another network? how to connect?
you need NLD (serial technology) if both networks are within one country or ILD for multi national link to connect distant networks. Both have WAN network links required mid range routers of L3 switches to have such link. You are talking about point to point link beetween 2 distant networks, are mostly connect with serial technology.
Simply put, if you have all administrative rights and permissions, you should probably use a tunnel to bridge the 2 networks and place the Access database on a shared drive.
Note that I absolutely don't recommend this as it will be slow as hell and Access is not a database server, so don't count on it to perform at all.
A real solution would be to convert your Access DB to a real DB server like Oracle, Informix, MySQL or other similar products and use ODBC from your VB program.We have the database of Access in 1 network and front-end of VB to totally in another network? how to connect?
you need NLD (serial technology) if both networks are within one country or ILD for multi national link to connect distant networks. Both have WAN network links required mid range routers of L3 switches to have such link. You are talking about point to point link beetween 2 distant networks, are mostly connect with serial technology.
Using VB, how can i prevent the results to be shown if the values inserted are wrong?
For example, if the user inserted in two text fields two values out of range and then he pressed OK, some unknown values such as (Nan) is shown in the result text, what codes shall i use to make warning box that to come out and ask the user to insert values within specific range and prevent the those unknown values to be shown in the Result text?Using VB, how can i prevent the results to be shown if the values inserted are wrong?
I don't know VB, but try this tactic. I know that in Java, there is something called a JFormattedTextField where you can say what data can be typed in, see if there's something like that in VB. Or, you could use a spinner (a text field with two arrows pointing up and down) to scroll through values. If this was in Java, I could have helped you a bit more.
I don't know VB, but try this tactic. I know that in Java, there is something called a JFormattedTextField where you can say what data can be typed in, see if there's something like that in VB. Or, you could use a spinner (a text field with two arrows pointing up and down) to scroll through values. If this was in Java, I could have helped you a bit more.
How to write one project exe open at the time same project exe cant open another time in vb.net?
example: SampleProject.exe open and working at the time same system without close sampleproject.exe. cant open sampleproject.exe.
now my exe open each time please help. only one time open exe.How to write one project exe open at the time same project exe cant open another time in vb.net?
One idea is to store a value in the Registry that tells your program if another instance of the program is running. In other words, you would use a key like ';IsRunning'; and set it to True (using SaveSetting) while your program is running, and set it to False when the program terminates. Have the program use GetSetting when it starts, and if IsRunning is True, pop up a message box to tell the user that another instance is running and then exit.
now my exe open each time please help. only one time open exe.How to write one project exe open at the time same project exe cant open another time in vb.net?
One idea is to store a value in the Registry that tells your program if another instance of the program is running. In other words, you would use a key like ';IsRunning'; and set it to True (using SaveSetting) while your program is running, and set it to False when the program terminates. Have the program use GetSetting when it starts, and if IsRunning is True, pop up a message box to tell the user that another instance is running and then exit.
What should I be aware of for a migration from VB.NET 2003 to VB.NET 2008?
Hey all,
I've been asked to take a very large program and migrate it to the lastest version of VB.NET. How big a project is this and are there any things I should look out for or plan for?
Any tips/tricks/ideas?
Thanks in advance!What should I be aware of for a migration from VB.NET 2003 to VB.NET 2008?
As stated above, the project converter will take care of this for you.
The only caveat I can think of offhand is if your 2008 application references a 2003 web service. In that case, you'll want to make sure your 2003 web service runs as a .NET 2.0 or 3.5 application (you can change this in IIS).What should I be aware of for a migration from VB.NET 2003 to VB.NET 2008?
any one idea about how to download .net 2008
You shouldn't have any problem migrating it. Visual Studio 2008 will have a wizard that will ask you a few questions before doing so.
The simple conversion will not be to bad. That being said there have been numerous things added that will make the program ';better';. Generics would be one aspect that you might look into adding in. Also you might consider replacing all of the manual dispose with using statements and let all of that be handled in a more efficient manner. Depending on the application you might benefit from some of the features added in 2008 as well such as LINQ etc. Also my experience has shown that there were people using direct sql statements in 2003. I would like to believe that they are all gone now but that is a different question. Make sure that all of your data calls are coming through procedures if that is not something already in place. Other than that bring good coding practices up and maybe change everyplace that you get a warning telling you there is a new way to do something and you should be fine.
I've been asked to take a very large program and migrate it to the lastest version of VB.NET. How big a project is this and are there any things I should look out for or plan for?
Any tips/tricks/ideas?
Thanks in advance!What should I be aware of for a migration from VB.NET 2003 to VB.NET 2008?
As stated above, the project converter will take care of this for you.
The only caveat I can think of offhand is if your 2008 application references a 2003 web service. In that case, you'll want to make sure your 2003 web service runs as a .NET 2.0 or 3.5 application (you can change this in IIS).What should I be aware of for a migration from VB.NET 2003 to VB.NET 2008?
any one idea about how to download .net 2008
Report Abuse
You shouldn't have any problem migrating it. Visual Studio 2008 will have a wizard that will ask you a few questions before doing so.
The simple conversion will not be to bad. That being said there have been numerous things added that will make the program ';better';. Generics would be one aspect that you might look into adding in. Also you might consider replacing all of the manual dispose with using statements and let all of that be handled in a more efficient manner. Depending on the application you might benefit from some of the features added in 2008 as well such as LINQ etc. Also my experience has shown that there were people using direct sql statements in 2003. I would like to believe that they are all gone now but that is a different question. Make sure that all of your data calls are coming through procedures if that is not something already in place. Other than that bring good coding practices up and maybe change everyplace that you get a warning telling you there is a new way to do something and you should be fine.
Subscribe to:
Posts (Atom)