|
previously, when generating reports, I entered a range of dates by means 2 textboxes. However, for the purposes of validation, i found this an inadequate way (eg it allows entry of days > 31 etc). instead i have started to use an MaskEdBox, i have set the DataFormat to Date, how do i set the format to ##/##/####? does it have similiar properties to that of the textbox? (ie MaskEdBox.Text etc)any help would be greatly appreciated, i am a newbie to this control!Thank you!
|
|
|
|
|
mcm wrote:
how do i set the format to ##/##/####?
MaskEdBox1.Mask = "##/##/####"
You will need to check the values to make sure that the user entered the correct values, I would suggest you write a function:
Private Sub MaskEdBox1_KeyPress(KeyAscii As Integer)
'Do your stuff here...
End Sub
Nick Parker
The only man who never makes a mistake is the man who never does anything. - Theodore Roosevelt
|
|
|
|
|
Why dont' you try a DTPicker control - resembles a Combo, but when you hit the drop-down, it shows a Month in a calendar control. Still possible to directly enter a date, but won't let you enter an invalid one.
To use, right click your toolbox and select components. Scroll down the resulting list, and select "Microsoft Windows Common Controls 2 6.0 SP4", or browse to MSCOMCTL2.ocx. This will add the control to your toolbox, and can be used in the normal way. Help for the control is in MSDN under VBReference->Controls Reference->ActiveX COntrols
(Apologies if the preceeding is teaching my granny to suck eggs!)
|
|
|
|
|
Dim updateSQL As String
updateSQL = "Update Product Set " & _
" Description = '" & txtDesc.text & "', " & _
" Where Code = '" & txtCode.Text & "'"
Set RS = Conn.Execute(updateSQL)
This statement executes fine when i test it in access but here, it returns the above error. I have checked that all the fields are the same as that in the database and the textboxes match aswell. Neither txtcode or txtDesc are bound to any component. What could the problem be? if you need any more information, please let me know, any help would be greatly appreciated!!
|
|
|
|
|
You don't need the comma after the txtDesc.text. So the correct SQL command should work with:
updateSQL = "UPDATE Product SET Description = '" & txtDesc.text & "'" & _<br />
"WHERE Code = '" & txtCode.text & "'"<br />
<br />
Set RS = Conn.Execute(updateSQL)
HTH
|
|
|
|
|
Hi - i have a website in ASP, and was wondering if it's possible to have a status display of my login status for MSN messenger? (u know like the Yahoo! logged in/not logged in script)
Thanks
Paul W
Only the good die young, all the evil seem to live for ever. - Iron Maiden, Only the Good Die Young
modified 18-Jul-18 11:59am.
|
|
|
|
|
I have an app written in VB6 which uses the MSHFlexGrid. I would like to add heading to the columns which have two lines. Is it possible to use a CR in the heading text or am I forced to use two rows?
If as I suspect I have to use two rows, how do I hide the row lines in the heading rows?
|
|
|
|
|
Hi, I want to make such a software in which i want to connect my SQL database situated on a remote server to the software residing in my PC. So is there any other apporoach other then creating the DSN and using it with ADO?
Please tell me to be a professional software developer should i develope command over VB of VC++
Regards
|
|
|
|
|
Think that you may be misunderstanding things here a little. If you specify a DSN in an ADO conneciton string, the conneciton will actually go through the ODBC driver / layer. However, if you specify a connection string of the format:
strConnString = "Provider = SQLOLEDB;Database=<DBNAME>;<br />
Datasource=<SERVERNAME>"
Then the OLEDB provider for SQLServer will be used to connect to the machine specified by <servername> and the database specified by <dbname>. You'll also have ot provide a UID and PWD though.
|
|
|
|
|
Hi all,
Friend asked me the following question, and since I do not know VB at all, i'll try it here.
So, in a Excel macro, he wants to set the active printer as "\\NTS198\\PFK" which is our color printer. But the port used to install the printer differs from user to user, that is, name of the printer in Excel is sometimes "\\NTS198\\PFK auf Ne02" or "\\NTS198\\PFK auf Ne01". and using Application.ActivePrinter() will throw an error if the name of the printer is not correct. So my question is, how do I find the port on which the "\\NTS198\\PFK" printer is on, so that i can use Application.ActivePrinter() without error ?
~RaGE();
|
|
|
|
|
Hello,
I am developing an application in which i use the OfficeXp component to display the values from the database.
Now i face a problem in making Print Preview and Printing the SpreadSheet using Visual basic.
Thanks,
Regards,
maheswaran
|
|
|
|
|
Hi...Sorry to be a pest. Perhaps related to my earlier post, but I'm getting the following message when I preview the dataset in the IDE: ForeignKeyConstraint 'EmployeeComments' requires the child key values (115) to exist in the parent table.
This doesn't make sense. The relationship seems easy enough. The primary key and foreign keys are the same as far as Interger (8), nulls not allowed. Any ideas.
Thanks in advance,
Mike
|
|
|
|
|
Simple. You have two tables (Table1 and Table2). Table2 has records that relate to records in Table1. The only thing holding the relationship is the fact that the two tables share a common field:
Table1: Table2:
recID ID# of record recID ID# of record in table 1
Name Some name Info1 Some information related to table1
Address Some address Info2 Some information related to table1
Both tables share a recID field. But, Table2 can have multiple records with the the same recID from Table1, this is a 1-to-many relationship. One record in Table1 is related to Many records in Table2.
The problem your running into is there is a recID in Table2 that doesn't exist in Table1. It's a record that doesn't have a relationship to any record in Table1.
You can probably code a SELECT statement to find the 'orphaned' records in Table2 for you, but I don't know exactly how to do it.
|
|
|
|
|
Hi...I've designed a form (winform) using VB.net standard. I used the data form wizard to construct it. It has a parent table record and 2 child table datagrids connected via oledb. I'll get into the construction when all of a sudden I get this message "DataBinding could not find a row in the list that is suitable for all bindings." What the hell is this? I can't find it anywhere in the knowledgebase or newsgroups. It is driving me crazy. The form code (.vb) is still there but the form (designer) is all screwed up. This has happended several times. Am I the only one who has experienced this. Microsoft....are you there?
Thanks in advance,
Mike
|
|
|
|
|
hey, i'll post this again, it got deleted last time..
All i wanna know is where I can find some GOOD tutorials for VB.Net
I've read my textbook several times...
Possibly a tutorial for graphics (games)
Thanks
______________________________________________
"I'm not me when I dream...anymore." -TRUSTcompany
|
|
|
|
|
Please someone one respond!!!
______________________________________________
"I'm not me when I dream...anymore." -TRUSTcompany
|
|
|
|
|
Please someone respond!!!
______________________________________________
"I'm not me when I dream...anymore." -TRUSTcompany
|
|
|
|
|
|
I am using VB.Net and would like to obtain a list of all the running applications on a PC.
I have looked at the Process Class but don't know if this is the right/best/simplest way of achieveing what I want.
I only need to list items with user interfaces (windows) not services.
Any ideas apreciated.
|
|
|
|
|
Don't worry, someone posted the following code sample which solved my problem:
Dim current As Process = Process.GetCurrentProcess()
Dim processes As Process() = Process.GetProcesses
Dim ThisProcess As Process
For Each ThisProcess In processes
'-- Ignore the current process
If ThisProcess.Id <> current.Id Then
'-- Only list processes that have a Main Window Title
If ThisProcess.MainWindowTitle <> "" Then
ListBox1.Items.Add(ThisProcess.ProcessName)
End If
End If
Next
|
|
|
|
|
http://files.danen.org/h/prg_vbnet.shtml will be the repository for my project files. Solutions to MY problems.
Feel free to contribute.
The entire http://files.danen.org/ site contains programming and networking related downloads.
Enjoy!
Gerry
|
|
|
|
|
I am facing very simple problem (i alreday overcome from this problem before but at the moment i am unable to find the way )
Problem is
I am writting(saving) a excel file from program ... before saving the file i open a "ShowSave" dialog from which i am taking the file name from it ... ( the dialog box prompt for ALREADY EXISTS file .. if any) ... but when i am finally going to save the file from "WorkBook.SaveAs" Microsoft Excel againg prompt from Overwrite message. I want to avoid this "OVERWRITE Message" ... since i already asked from user before ...
I know this can be done (since i already done this VC long time ago ) but how ...
Please help ...
Any word, code, sample, web site, any thing will help me lot
Thanx to all in advance
|
|
|
|
|
I got it ... it is
AppExcel.DisplayAlerts = False
Thanx for all
But there is one more problem i am facing and this is when EXCEL.EXE is still in running condition, even i close the Application. I check it through Task Manager. For closing the Excel Application I use following code.
AppExcel.DisplayAlerts = False
wBook.SaveAs FileName:=strFileName, FileFormat:=xlNormal, ConflictResolution:=False
Set wSheet = Nothing
Set wBook = Nothing
AppExcel.Quit
Set AppExcel = Nothing
After last line i check the Task Manager ... their is still a EXCEL.EXE running ....
How i resolve this ...
Again thanx in advance
|
|
|
|
|
uSQL = "Insert Into OrderDetails2 (OrderNumber, ProductCode, ProductDesc, Quantity, Price) " & _
" Values (" & iOrderNo & ", '" & strCode & "', '" & strDesc & "', " & iQuantity & ", " & iUnitPrice & "," & iFullPrice & ")"
Set RS = Conn.Execute(uSQL)
Me.Adodc3.Refresh
Me.DataGrid2.Refresh
the above code is used to populated the datagrid first time round, by the click event of a command button. Price relates to UnitPrice*Quantity, which is calculated prior to the population of the grid, on the click of a command button. i cant edit the quantity in the datagrid directly due to the calculation that is required for FullPrice (ie Qty * Price). so instead i change the quantity in the datagrid (all other columns except FullPrice are set to locked) and press an "Edit" button which contains the following code:
Dim strCustomerCode As String
iOrderNo = txtOrderNo.Text
strCustomerCode = Me.txtCustomerCode.Text
strProductCode = DataGrid2.Columns("ProductCode")
DataGrid2.Columns("ProductCode").Locked = True
DataGrid2.Columns("ProductDesc").Locked = True
iPrice = Datagrid2.Columns("UnitPrice")
Dim iGridQty As Integer
DataGrid2.Columns("Quantity") = iGridQty
iFullPrice = iPrice * iGridQty
DataGrid2.Columns("Price") = iFullPrice
DataGrid2.Columns("Price").Locked = True
With Adodc3.Recordset
Dim editSQL As String
editSQL = "Update OrderDetails2 " & _
" Set OrderDetails2.Quantity = " & iGridQty & ", " & _
" OrderDetails2.Price = " & iFullPrice & " " & _
" where OrderDetails2.ProductCode = '" & strProductCode & "' AND OrderDetails2.OrderNumber = " & iOrderNo & ""
Set RS = Conn.Execute(editSQL)
End With
MsgBox ("Record Updated")
The record updates fine in the table but when i leave the datagrid ,i get the following error message: "Cannot be updated for updating. Some values may have been changed sinse it was last read". What am i doing wrong? If you need any more information or explanation, please let me know - any help would be greatly appreciated!
|
|
|
|
|
I'm very new to .net .... any help is much appreciated!
I'm using vb.net and visual studio.net to build a form. This form has two textboxes (textbox1 and textbox2). I'm trying to drag and drop the value of textbox2 into textbox1. Further, after the drop, I went textbox2 to retain the value of textbox1. A swap. See illustration below:
Figure 1 - The initial state of both textboxes
Textbox1 Textbox2
15 37
Figure 2 - The state of the textboxes after the drag and drop
Textbox1 Textbox2
37 <----- 15
So far, I've gotten this to work:
Textbox1 Textbox2
37 <----- 0
I've debugged what I've done so far, and checked the call stack. What's happing so far is:
1. The mousedown event occurs on textbox2. This even triggers the drag and drop event of textbox1
2. In the textbox1.drag_and_drop(), I've added some code to set textbox1.text = <new value="">
3. Control is returned back to textbox2.mousedown() where I set textbox2.text = 0
I've tried overloading the procedure textbox1.drag_and_drop() to include a 3rd, byRef, argument oldValue as String, that I set to the original value of textbox1.text. However this doesn't compile because textbox1.drag_and_drop() HANDLES dragdrop.
My question is this: What's the easiest way of getting this done? If I'm going down the right road, how do I overload the dragdrop event so that I can implement this 3rd argument? If I overload the event, do I need to recreate all the code associated with dragdrop?
|
|
|
|