|
Try/Catch blocks are very much the better way to go. Error handling doesn't add a huge overhead to your code, so I don't know why that's a concern... If your code errors out, Error Handling definately wins the speed competition, because if you don't the error, your code comes to a screeching halt.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
sure, but you cannot apply any Resume ... (even if - i aggree - goto s are quite bad to use...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
If your code is written correctly, why on earth would you need to?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
while programming in console mode, this becomes very useful when getting a bad user input and want to get it again until the user type its value correctly...
this can't be done with exceptions (try and catch blocks) except if you use explicit goto s, that behavies the same...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
Wanna bet?! Just a little something off the top of my head...
Dim validInput As Boolean = False
Dim choice As Integer
Do
Try
choice = Console.ReadLine()
...Whatever else you need...
If choice is valid Then
validInput = True
End If
Catch ex As Exception
...Whatever you want here...
End Try
Loop While Not validInput
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Ok everybody,
This may sound kinda silly but this is what i m unable to do.
I was working on VS.NET and had MSDN fine and working. Now i need to work on VS6 but i unable to use MSDN through VS6 although its installed on my machine. How do i link MSDN with VS6???
Laddoo
|
|
|
|
|
I think you got a good question. Anybody out there to solve this?
Smith
KB Team
|
|
|
|
|
You installed both on the same machine? The MSDN Library hasn't supported integration with Visual Studio 6 for roughlt the last 2 years...
I can't remember if you can install two different editions of MSDN side-by-side. IMHO, I don't think you can...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I don't think there were any issues, but my laptop is evidence that you can have 2 MSDN installed at the same time. I have one from October, ???? which was the last full MSDN before .Net, and I have the one from VS.Net 2003. They both work properly from their respective development environments.
|
|
|
|
|
Anyone of u know how to export crystal report to word without using textboxes??
thanks...
|
|
|
|
|
Does somebody knows how to call Oracle Stored Functions in VB Net, I am very very tired trying one time and once again, and so on.
Please is urgent!!
Thanks in advanced.
|
|
|
|
|
Use the OleSqlwhateveritis generic class provided by ADO.NET for all sources except SqlServer. You aren't saying what you've tried, or what is happening, but my memory of Oracle ( which I am trying to erase, Oracle is crap ), was that the issue was finding a driver that worked properly. May you have driver issues ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hi Christian, I think is not an issue with drivers becouse I can call Stored Procedures fine, however I can't call Functions which are stored in Oracle Packages.
I am using the next code in VB Net:
Public Sub MY_PKG_ADD_NEW_ITEM(ByVal ConnectionString As String _
, ByRef N_ITEM_ID_O As Integer _
, ByVal V_ITEM As String)
Dim oConn As New OracleConnection(ConnectionString)
Dim oraCmd As New OracleCommand("", oConn)
oraCmd.Connection = oConn
oConn.Open()
oraCmd.CommandText = "MY_PKG.ADD_NEW_ITEM"
oraCmd.CommandType = CommandType.StoredProcedure
'oraCmd.Parameters.Add(New OracleParameter("N_ITEM_ID_O", OracleType.Number, 3)).Direction = ParameterDirection.Output
'oraCmd.Parameters.Add(New OracleParameter("V_ITEM", OracleType.VarChar, 2000)).Value = V_ITEM
'oraCmd.Parameters(1).Direction = ParameterDirection.Input
Try
oraCmd.ExecuteNonQuery()
N_ITEM_ID_O = oraCmd.Parameters("N_ITEM_ID_O").Value
Catch
'MsgBox(Err.Description)
Finally
oraCmd.Dispose()
oConn.Close()
End Try
End Sub
The error what I am receiving is:
ORA-06550: line 1, column 7:
PLS-00221: 'ADD_NEW_ITEM' is not a procedure or is not defined
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
The software I am using is:
VB Net 2002 version
Oracle driver is System.Data.OracleClient (.NET Framework Data Provider for Oracle)
I am getting conected to an Oracle 9i data source.
I hope this info complete my scenario so to get more help from you.
Thanks in advanced !!
|
|
|
|
|
you need to set a returnValue parameter (where the function result will be
stored) and execute as "ExecuteNonQuery"
Ishak
|
|
|
|
|
Here is a differente way to prepare the calling to the stored function:
Public Sub ADD_NEW_ITEM(ByVal ConnectionString As String _
, ByRef ITEM_ID_O As Integer _
, ByVal V_ITEM As String)
Dim oConn As New OracleClient.OracleConnection(ConnectionString)
Dim rtnVal As New OracleClient.OracleParameter("", Conn)
Dim inpVal As New OracleClient.OracleParameter("", Conn)
Dim outVal As New OracleClient.OracleParameter("", Conn)
Dim oraCmd As New OracleClient.OracleCommand("MY_PCKG.ADD_NEW_ITEM", oConn)
oraCmd.CommandType = CommandType.StoredProcedure
outVal = oraCmd.CreateParameter
outVal.ParameterName = "ITEM_ID_O"
outVal.OracleType = OracleType.Number
outVal.Direction = ParameterDirection.Output
outVal.Value = DBNull.Value
oraCmd.Parameters.Add(outVal)
inpVal = oraCmd.CreateParameter
inpVal.ParameterName = "V_ITEM"
inpVal.OracleType = OracleType.VarChar
inpVal.Size = 2000
inpVal.Direction = ParameterDirection.Input
inpVal.Value = V_ITEM
oraCmd.Parameters.Add(inpVal)
Try
oConn.Open()
rtnVal.Direction = ParameterDirection.ReturnValue
rtnVal.OracleType = OracleType.Number
rtnVal.ParameterName = "ITEM_ID"
rtnVal.Value = oraCmd.ExecuteNonQuery
oraCmd.ExecuteNonQuery()
Catch
MsgBox(Err.Description)
Finally
oraCmd.Dispose()
oConn.Close()
End Try
End Sub
So I get the same results.
Thanks for your answer, do you have some other idea ?
|
|
|
|
|
what is wrong with this code. I am trying to create a shortcut that is displayed on the desk top.
this is in the declarations of the form
Private Declare Function fCreateShellLink Lib "STKIT432.DLL" (ByVal lpstrFolderName As String, ByVal lpstrLinkName As String, ByVal lpstrLinkPath As String, ByVal lpstrLinkArgs As String) As Long
This is in the form command click
Private Sub Command1_Click()
Dim lRETURN As Long
lRETURN = fCreateShellLink("C\documents and settings\administrator\desktop", "Shortcut to logbook", "c:\drags\logbookv10.exe", "")
End Sub
The results are:: NOTHING, NOTHING, NOTHING
What is wrong??????????????????????????????
|
|
|
|
|
Are you using VB5? STKIT432.DLL was replaced a long time ago with an updated one. But, you don't even need that one either.
If you're using VB6, use the Windows Scripting Library (set a reference to this) WshShell object and its CreateShortcut method to create the shortcut.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I am using vb4
|
|
|
|
|
Why? It's 10 years old! There's no support for it anymore. If you want to support the O/S's of today, you'll have to upgrade!
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
In VB.NET 2003, with a listview in large icon view, I need to allow the user to manually rearrange the icons using the mouse. Kind of like a DragDrop operation but not.
I tried all the prop setting for the listview but nada!
A good example would be Windows Explorer in Icons View, set to autoarrange. You can still have them all lined up but you can manually drag and re-arrange the icons.
What do I need to do to set this up?
Thanks for any help.
|
|
|
|
|
The ListView really doesn't have any support for this. In order to have the items rearrangable and allow the user to place the items anywhere they want, you have to have seperate objects for each item in the list and have each item track it's own position on screen. This tracking is not possible using the normal ListViewItem class.
You'd have to come up with your own ListView class and ListViewItem class, possibly extending the standard classes.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
That bites If vb6 was able to do it you think vb.net would support it too but in a complicated way, not lie that though
Any other possible way you can think of?
Thanks
|
|
|
|
|
How did you get it to work in VB6?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Here is some demo code for VB6. If you drag an item and drop it anywhere in the listview it will move to that position.
Option Explicit<br />
'Add a ListView to your form (ListView1)<br />
Private Sub Form_Load()<br />
Dim i As Integer<br />
With ListView1<br />
.Arrange = lvwAutoTop<br />
.HideSelection = False<br />
.LabelEdit = lvwManual<br />
.MultiSelect = False<br />
.Sorted = False<br />
.View = lvwIcon<br />
For i = 1 To 50<br />
.ListItems.Add , , i<br />
Next<br />
End With<br />
End Sub
|
|
|
|
|
I have a combo box in a VB 6 form that takes its list items from a Database Table.
when i add a new value in that list on the form by clicking on the add button I put an IF check on the add Button.
That IF check is that if the value is present in the list then it gives the msgbox that the value is already present and else it will add the value in the list of that combo box.
the Coding on the Add Button is:
if txtto.text = cboto. then
msgbox "The value is already present"
else
cboto.Additem txtto.text
end if
my problem is that the first part of the IF check doesnt works and by clicking add button it adds the value to the list. What code should I use in that first part of the IF check that it gets right? What property should i use for combo box to make it work correctly?
Its urgent plz help.
|
|
|
|