|
Well, sure it is. Did you try what I suggested ?
Anyhow, your structure sucks. Ans1 and Ans2 are different arrays ? You have an array of answers for the first spot, but the four answers that go with a question do not relate to each other ? You should have one array of a struct, with the four answers, and the correct one.
Then you get an array of four numbers, 0 to 3. You get a random number between 0 and 3, and you grab the index in this array of that number. That's the index for position one. You remove that number from the number array, get a random number between 0 and 2. Get hte number at that index. That's the index to show next. Etc.
Christian Graus - C++ MVP
|
|
|
|
|
Hello Sir
thank you very very much
I got it
and thank you very much for your very quick rep.
thanks again for this
byyyyyyyy
|
|
|
|
|
I am trying to populate a datagrid using a SQL select statement. The statement contains a "WHERE fieldname LIKE textbox.text" as below in my code. The problem is, I can't get the code right to display the data in the grid when the button is clicked. Here is my code so far:
Public Sub loadDoc()
Dim DAdapt As SqlDataAdapter
Dim custMap As DataTableMapping = DAdapt.TableMappings.Add("Table", "DocumentList")
custMap.ColumnMappings.Add("Title", "Title")
custMap.ColumnMappings.Add("Expiration", "Expiration")
custMap.ColumnMappings.Add("Keywords", "Keywords")
Dim sql2 As String = "Select * FROM DocumentList WHERE Keywords LIKE '" & tbSearch.Text & "'"
Dim ds As New DataSet
DAdapt = New SqlDataAdapter(sql2, cnn1)
Me.cnn1.Open()
DAdapt.Fill(ds)
Try
grdDocumentList.DataSource = ds.DefaultViewManager
ds.Clear()
ds.Merge(ds)
grdDocumentList.SetDataBinding(ds, "DocumentList")
Catch eLoadMerge As System.Exception
Throw eLoadMerge
End Try
Me.cnn1.Close()
End Sub
Thank you,
LWhite
|
|
|
|
|
Hmmm, I have never done it like that, try something like this
Dim DAdapt as new SqlDataAdapter
DAdaPt.SelectCommand = new SqlCommand
DAdapt.SelectCommand.CommandType = CommandType.Text
DAdapt.SelectCommand.Connection = cnn1
DAdapt.SelectCommand.CommandText = "Select * FROM DocumentList WHERE Keywords LIKE '" & search.Text & "'"
Dim ds as new Datatable("Display")
try
DAdapt.fill(ds)
Catch ex as SQLException
end try
grdDocumentList.Datasource = ds
|
|
|
|
|
Sweet! Thank you very much, that worked. I appreciate the assistance.
LWhite
|
|
|
|
|
I added another variation to this code that works very nicely to provide a search based on part of the "Keywords" field. Add this to the btnLoad_Click sub:
tbSearch.Text = "%" & tbSearch.Text & "%"
Again, Thanks to Kevin for the assist! Got the creative juices flowing again, lol.
LWhite
|
|
|
|
|
I am trying to copy a file from a web folder
("http://server/folder/file.ext") to a regular folder from my com+ component.
I was using an ADODB.Record with the msdaipp oledb provider. This works fine
in a desktop application but when I moved the code to my component - it
turns out this provider (because it uses wininet) cannot be used in a middle
tier or server side application. I am getting the error message "cannot find
the provider ...". The regular desktop app works fine on the same machine.
Do I have any other alternative? What other technique can I use to copy a file located on a web folder using my Com+ component and VB?
Thanks!
|
|
|
|
|
I am having a problem with accessing a web service and am hoping that someone out there can help me out...
I am working on a VB windows forms application that will access a web service running on a Windows 2003 server. As I am starting a new project, I decided that it's a good time to move from Visual Studio 2003 to Visual Studio 2005. My problem is that with VS2005 I can not access the web service and with VS2003 I can. Additionally, if I turn of my web proxy (Control Panel, Internet Options, Connections, LAN Settings) the web service works fine with VS2005. Unfortunately, turning off the proxy server is not an option. The error I get running VS2005 with the proxy server is "The request failed with HTTP status 403: Forbidden."
This is a sample of the code I'm working with:
Dim FAMISService As New FAMIS6.ImportEntity
Dim dtFAMISLocations As DataTable
FAMISService.PreAuthenticate = True
FAMISService.Credentials = System.Net.CredentialCache.DefaultCredentials
FAMISService.Proxy = System.Net.WebRequest.DefaultWebProxy
FAMISService.Proxy.Credentials = System.Net.CredentialCache.DefaultCredentials
dtFAMISLocations = FAMISService.GetLocations().Tables(0)
I've tried it with and without the service proxy settings with no effect. Any thoughts or suggestions would be appreciated.
Regards,
TJS
|
|
|
|
|
After visual studio application is created, I copied all the files to another machine because I want to run it on another machine.
1. Does the local machine need to have SQL server installed in order to run the application?
2. Since Visual Studio application uses the SQL server path for connectionstring of development machine, How can I change the path on local machine to run the application?
3. Do I need to copy SQL Server database to local machine?
Any help would be appriciated.
Thank you in advance.
programmer
|
|
|
|
|
There should be no need to install SQL Server on the machine that the application is going to be run from. If you built the connection string on the development machine by dragging a connection from the server explorer into the development area, this string should work on any machine. This assumes that you aren't using windows authentication to connect to the server. (If thats the case make sure the user using the app has correct authentication to SQL Server on the data server). IF all that was done and the users machine is in the same network architecture as your development machine. It should work without problem.
-- modified at 13:33 Wednesday 15th November, 2006
|
|
|
|
|
I am a student in a colege, one of my projects involes making a program and learning about Visual Studio.
Getting Straight To the Point, I have looked on the internet at various dlls for zipping and compressing with a password ect, but i can't find a website that tells me how to include the dlls so that i can use them.
it would be greatley apreicated if someone could give me example code of a program that zips a file and unzips a file....
Most of the ones i have found have been For Vb6.
I can't seem to use this code, and don't know enough to convert it.
Please only answer with Visual Basic Code...... 2005 Edition
Thanks For Any Help, i have spent two days googling and now i think my head will explode.....thanks for any help.
Learning, For The Next Generation.......
|
|
|
|
|
have you looked at gzipstream ? it can do what you want...
|
|
|
|
|
Can this be? Does the getFiles method alter the LastaccessedDate? If so does anyone know a way around this problem. I am developing a program that just cannot have its files data altered in any way.
Any help fro you all would be greatly appreciated.
GT
|
|
|
|
|
GaryT80 wrote: Does the getFiles method alter the LastaccessedDate?
I can't really imagine that it would.
Do you have any observations of it doing this?
---
b { font-weight: normal; }
|
|
|
|
|
I think so. I am having it tested as we speak. But it seems that it is altering the files time stamp.
|
|
|
|
|
I have documented the altering of the LastAccessedDate using the GetFiles method. It does not change every file though. I am finding this to be very odd.
|
|
|
|
|
How do you check if LastAccessedDate has changed?
If you for example check the properties in explorer, it might read the file to get some properties. If it's a media file, for instance, it will read the file to find out things like duration, resolution and bitrate.
---
b { font-weight: normal; }
|
|
|
|
|
I am using a proprietary assembly to extract all metadata and properties from files. I know this is not the culprit in the situation. the code I am using to process a directory is as follows:
Public Function ProcessDirectory(ByVal targetDirectory As String) As String()
Static tcnt As Integer
Static tfiles As String()
Static cnt As Integer = 0
Dim fileEntries As String() = Directory.GetFiles(targetDirectory)
' Process the list of files found in the directory.
Dim fileName As String
For Each fileName In fileEntries
ReDim Preserve tfiles(tcnt)
tfiles(tcnt) = fileName
tcnt = tcnt + 1
Next fileName
Dim subdirectoryEntries As String() = Directory.GetDirectories(targetDirectory)
' Recurse into subdirectories of this directory.
Dim subdirectory As String
For Each subdirectory In subdirectoryEntries
ProcessDirectory(subdirectory)
Next subdirectory
Return tfiles
End Function
Maybe you all can see something that I am not.
GT
|
|
|
|
|
GetFiles shouldn't do it, but right-clicking the file and clicking Properties WILL change the LastAccessed time on files stored on NTFS volumes. It's better to rely on the Modified date and time, not LastAccess.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
i have to build blackjack for my project and im having difficulty with the class for the cards. i can get the number to work i am unsure on how the suits work. has anyone built a playing card class at all? many thanks if u could help!
|
|
|
|
|
I wrote classes for card and deck as an example not so long ago. Search for it in the forums.
---
b { font-weight: normal; }
|
|
|
|
|
I was wondering if anyone had a good solution to replacing VB6.FixedLengthStrings(). I need to be able to have a constant length for strings in a function. I tried Dim str As String = Space(#), and that works fine until you set the string to its value (spaces disappear), so its apparent that is not the correct way to fix this problem. Ive been thinking about testing to see the difference between the max length of the value and the max length of the string, but I'm not sure how to put a certain number of spaces to the end of the string as you cannot insert spaces with string.insert(pos, chars). Any thoughts?
Nathan Lindley
|
|
|
|
|
<VBFixedString(15)> Dim sVal as string
Or
CONST MIN_SIZE as int16 = 15
Dim s As String = ""
s = "Hello"
s = s.PadRight(MIN_SIZE, " ")
|
|
|
|
|
Tried the first one but it was to no avail, but the second one is money. Thanks.
Nathan Lindley
|
|
|
|
|
Does anyone know how to make a picturebox control where it is always centered on the form. I have an MDI parent form that is always maximized but depending on the size of the monitor the picture box in the middle isnt always in the middle. I need a way to set this picture box to always be in the center of the form. Thank you.....
|
|
|
|