|
Hi Daniel...Thanks for the reply to my post. I can either put the code in a reply or email it to you if you're curious - I ask because it is a couple thousand lines of code generated by the data wizard. If you had a suggestion of what specifically to look for, I could copy and paste it to a reply. On another note, do you know if you can 'update' (uses a merge I believe) more than one row at a time? Again thanks. Mike
Thanks,
Mike
|
|
|
|
|
Hello people =)
I want to take a selected row from a ListView and transfer the information to TextBoxes or Labels. How do I do it?
/Marcus
|
|
|
|
|
Hi,
For example, if your listview (lswMyListView) has two columns, and you want to transfer the selected row into two textbox (txtColumn1 and txtColumn2) you have to do that (for instance, in the lswMyListView_Click procedure) :
txtColumn1.Text=lswMyListView.SelectedItem.Text
txtColumn2.Text=lswMyListView.SelectedItem.Subitems(1)
Hope this helps !
Jerome
|
|
|
|
|
Hi
I am having a problem assigning a date to a date field in an Access database using VB. I know how to do it using a string.
Dim stLinkCriteria As String
stLinkCriteria = "[Name] = 'whatever'"
Do I somehow use the #'s ?
Thanks
Nitin
|
|
|
|
|
try...
Dim strLinkCriteria as String
strLinkCriteria = "MyDate = #" & Me.ctlWhatever & "#"
the principle being that 1) any string that can be evaluated as a date, and 2) is enclosed in #'s, will 3) be evaluated as a date, so if Me.ctlWhatever.Value = "2/28/03" then...
strLinkCriteria = "MyDate = #2/28/03#" 'm/d/yy
no matter where you go, there you are
|
|
|
|
|
dear all,
how can i unload a Form from the Form_Load event
if i use Unload me , i get an error Object Unloaded
plz. help
|
|
|
|
|
Hi !
I guess this won't help, but I tried to do this :
Private Sub Form_Load()
MsgBox "Hi !"
Unload Me
End Sub
and everything works fine.
Are you doing something special into the Form_Load event ?
Jerome
|
|
|
|
|
i'm checking the existence of previous instance of my app using following code
If App.PrevInstance Then
MsgBox "An Instance Of The Application Is Already Running!", vbCritical, "Already Running"
SetForegroundWindow
End
End If
it is working alright
but i was pondering over 2 scenarios
1) if i use unload me instead of End then the msgbox comes as if it is in an infinite loop (keeps popping up when i press OK)
2) if a prev instance is running, i want the running application to get on top of all windows.
i know i've to use SetForegroundWindow, but i've no clue waht to pass in the parameter
any help will be appreciated
thanx in adv
|
|
|
|
|
Ok im using VB.net, a console app.
I am making a database that stores games(members also, name, genre, rating)
i'm dividing the main code into some sub procdures and functions for easier readability.
So i have one sub for displaying the main menu(add, view..etc)
But now i wanna make a function to add a game to the array...
so i ask the user for the info, but how do i return all the values seperatly??
i tried assigning them directly to the
array(gameArray.name = console.readline()), but it doesnt work...
Any ideas will help!!
______________________________________________
"I'm not me when I dream...anymore." -TRUSTcompany
|
|
|
|
|
It sounds like you want to build a function that askes the user for three items and then returns those items so they can be used in anohter part of the program...
Buld a structure as so and declare it outside the function:
Public Structure InputData
Dim arg1 As type_name
Dim arg2 As type_name
Dim arg3 As type_name
End Structure
In your function create an instance of the structure, get all your input and assign each piece of input to each structure member:
Public Function GetInput() as InputData
Dim userResponse as InputData
'Get your input here
.
.
.
'assign each pice of input to your structure members
userResponse.arg1 = inputValue1
userResponse.arg2 = inputValue2
userResponse.arg3 = inputValue3
'return your data from the function
Return userResponse
Now you can call the function as so:
Dim returnData as InputData
returnData = GetInput()
From here if you want to pass it to another function to write the data to a DB you can simply do this:
Public Sub WriteDataToDB(inData As InputData)
'open the DB
'write each value to the DB
'you access each argument by the following
inData.arg1
inData.arg2
inData.arg3
.
.
.
End Sub
Hope that helps and I hope there are few typos
Paul Watson wrote:
"At the end of the day it is what you produce that counts, not how many doctorates you have on the wall."
George Carlin wrote:
"Don't sweat the petty things, and don't pet the sweaty things."
Unknown wrote:
"I love long walks, especialy taken by those that annoy me."
|
|
|
|
|
Thanks Ray that kinda helps...
but i'm still not sure why i'm doing that...
Maybe i didnt explain it good enought..
I making an array, that has 3 members (name, genre, rating)
Overall i want a little menu
1) Add a game
2) Display a game
3) Show average rating of games
4) Quit
Something like that..so first i made a sub prodecure that displayed this menu (so i can call it after each option the user makes), that was all good
So the sub main looks like this so far
Private Sub Main()
Dim gamesArray() as Game 'Game is a declared structure above sub main)
Dim choice as integer
call DisplayMainMenu()
choice = console.readline()
End Sub
So then I started to do this:
Private Sub Main()
Dim gamesArray() as Game 'Game is a declared structure above sub main)
Dim choice as integer
call DisplayMainMenu()
choice = console.readline()
If choice = 1 then
* call AddGame()
End if
End Sub
Private Function AddGame()
console.write("Enter the game name: ")
name = console.readline()
console.write("Enter the genre: ")
genre = console.readline()
console.write("Enter the games rating: ")
rating = console.readline()
End Function
*** So my question being, if i get the info for the game in the function..
i somehow need to get all 3 pieces back up into the array...
Hope this clarifies things...
EDIT: Sorry forgot the IF
______________________________________________
"I'm not me when I dream...anymore." -TRUSTcompany
|
|
|
|
|
Hi
I was wondering how I would be able to assign a date to a date object.
Dim temp As Date
temp = ?
Thanks
Nitin
|
|
|
|
|
temp = #February 12, 1985#
you put any valid date expression between two #
|
|
|
|
|
I just installed VS.NET. Why is it that if I try to code in the html editor all the toolbox items are grayed out? However, if I go to design, they appear. Can I not use these buttons if I am coding by hand??
|
|
|
|
|
are you sure you're eding html ?
all items in the toolbox appear both in design and code when i open html file !!
|
|
|
|
|
Actually, the HTML tools are there, the ones I can't get to are the web form tools. I am editing ascx, aspx and they don't show unless I'm in design mode..
|
|
|
|
|
The use of apostrophes in a textbox, when using collaboration with a SQL statement causes trouble - i was wondering if theres any way to get around this - ie when inserting a value that contains an apostrophe, to omit it before using the SQL insert statement. Any help would be greatly appreciated!
|
|
|
|
|
You can use StringVar=StringVar.Replace("'", "") to remove the apostrophe from your string (where StringVar is your variable). There may be something more elegant, but this has worked for me.
|
|
|
|
|
You may want to think about using a parameterized query to pass the values into your SQL statement. Using the SQL Server data provider, it would look something like this:
<br />
Dim sql As String = "INSERT INTO Test (lname) VALUES (@LastName);"<br />
Dim cn As New SqlConnection(cnString)<br />
Dim cmd As New SqlCommand(sql, cn)<br />
cmd.Parameters.Add("@LastName", SqlDbType.VarChar).Value = Me.TextBox2.Text<br />
cn.Open()<br />
cmd.ExecuteNonQuery()<br />
cn.Close()<br />
Doing it this way will save you the trouble of replacing characters in each input field and will help protect against some forms of SQL Injection attacks. However, it won't get you out of validating input for other constraints such as length, etc.
Hope that helps!
|
|
|
|
|
If you're trying to insert into a database, just double-up the quotes, so :
INSERT INTO table VALUES 'O'Connor'
becomes
INSERT INTO table VALUES 'O''Connor'
have some functions to do this, or just use a replace. This approach has the advantage that the string is stored with the apostrophe in place
"Now I guess I'll sit back and watch people misinterpret what I just said......"
Christian Graus At The Soapbox
|
|
|
|
|
I'm trying to deploy an application and I'm getting an error that a newer version of a control is needed. Here are the details
1) My app uses an Access database and references 'ADODB', 'ADOR', 'System', 'System.Data', and a few other normal System references.
2) When I setup the Deployment Project, it appears that the references are correctly identified as dependencies (ADODB.dll, and Interop.ADOR.dll are both listed).
3) When I try to run my installer application on a different computer (w/o .NET installed, but after installing the .NET Framework), I get an error.
4) The specific error is: "The .Net Data OLE DB Provider (System.Data.OleDb) requires Microsoft Data Access Components (MDAC) version 2.6 or later. Version 2.53.6200.0 was found and currently installed)"
I did some research (by looking in references in VB6, since I couldn't find what I needed in .NET) and found the Microsoft Data Access Components is in odbcconf.dll. I tried including that as a file/assembly in my Development Project, but when I built the project, it gave me the following error: "WARNING: 'odbcconf.dll' should be excluded because its source file 'C:\WINNT\system32\odbcconf.dll' is under Windows System File Protection."
So, my question is, how do I get that file upgraded? Or maybe I'm looking at the wrong place? The funny thing is that, that very same DLL on my computer is version 2.52, and the project installs (using the 'Install' menu option under 'Project') and runs fine. The other thing I've tried to do is include the 'Database_Access.msn' merge module. That didn't work. BTW, all computers I've been working on/with are Win2000/SP3 machines.
I have searched the MS help, MSDN, and was searching other websites when I found this message board, so I apologize if the info is readily available somewhere on this website.
Paul
One more question... why does the Development project give an error about requiring the .NET Framework to be installed on the destination computer, but if I try to add the Merge Module associated with it, it gives me an error saying that it should be excluded?!
|
|
|
|
|
ElseIf optSuppOrder.Value = True Then
Load deMain
With deMain
.SupplierOrderAudit_Grouping txtUser.Text, CDate(Text5.Text), CDate(Text6.Text)
End With
SupplierOrderAudit.Refresh
If SupplierOrderAudit.Visible = False Then
SupplierOrderAudit.Show
End If
End If
if the above option button is chosen, the intended purpose is that the report is generated. However, occasionally, when the command button is pressed, it throws the above run time error pointing to the report line, why is this? any help would be greatly appreciated or if you need any additional info.
|
|
|
|
|
Just plucking at straws but the error may occur if deMain is already loaded (e.g. not unloaded properly from a previous report???).
Maybe you should look into creating a new instance of deMain each time you need a report....
If this isn't where you are receiving the errors thenignore my post
Rhys Kirk
|
|
|
|
|
The error you mention generally occurrs when attempting to open an ADODB.Recordset object when it's already open - if you're reporting from a DB, this will prob be the cause, but suspect that it won't be in your code? Does that help?
"Now I guess I'll sit back and watch people misinterpret what I just said......"
Christian Graus At The Soapbox
|
|
|
|
|
dear all,
1) how do i trap the double click event on an item in a list view control (style = details)
2) how do i make Xp style tool tips (i.e. tool tip with cancel button in the top right corner)
thanx in adv
|
|
|
|