|
hello i want to connect to the ftp through vb.net .. i cannot find something suitable for me. i am working with vb.net and i am very confused!! can someone give me a link or some help pls. i want to download and upload a txtfile only! i dont want it for nothing else. i want to make a small messanger thats it. thanks!!
|
|
|
|
|
|
Is there a way to use a dll that was created in vb.net by vba?
|
|
|
|
|
So long as your VB.NET DLL is properly exposed to COM and registered, then it should work just like any other component. VB.NET and C# don't export functions like you would find in a unmanaged code DLL.
You can find out more by searching the articles for "expose COM", or click here[^].
|
|
|
|
|
|
I have a simple syntax issue that is causing me grief. In one of my dropdowns, several of my users have used "&" or " ' " in their choices. eg. Pete's Meat & Grocery. In VBA, the solution would be simple, I would imploy use the following syntax to convert the entire response to a string:
'" & NameofField & "' or if the field was numeric " & NameofField & "
In VB.net, this does not work. The function that I am running halts on Pete's Meat & Grocery and states that it cannot interpret the ' or the &.
What syntax do I use so that the entire contents of the field are read as one regardless of whether any of the contents are reserve keys or wildcard characters.
Thanks
Pat
|
|
|
|
|
There's something you're not telling us. Just putting an '&' character in a String will not screw up your code. Is this going to a database or something? A code snippet of where the problem is occuring would help greatly!
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
This is part of an automatic 'save' function that I have developed. Here is a code snippet.
EditALLFields(Me.txtPaymentCounter.Text, cboPayableTo.SelectedValue, "tb_Payments", "PayableTo", "Counter", "String")
Where...
EditALLFields = Name of Function
Me.txtPaymentCounter.Text = Unique Row ID Number for Source Table (tb_Payments)
Me.cboPayableTo.Text = Value of Combo or Text Box
tb_Payments = Source Table
Counter = Unique ID Field of Source Table (tb_Payments)
String = DataType of Field that is to be saved (Me.cboPayableTo) (Could be string, numeric, or date)
Now... if the value of Me.cboPayableTo.text does not include a wildcard, reserved character, or " or ' then, the function properly saves the value in Me.cboPayableTo back to tb_Payments. Works perfectly.
However, in the example that I used: Pete's Meat & Grocery... we have two parts that halt the function. Both the ' and the & halt the function with an error message:
Incorrect syntax near 's'. Unclosed quotation mark before the character string.
I won't bore you with the syntax of the actual EditALLFields function, but if necessary, I can. It is actually very concise and tight. The EditALLFields function merely opens the data connection, identifies the correct table, record, and parameters and saves the record. I have developed this because my users have a severe distain to any 'Save' Button on the actual form. So instead, I simply run this function on the 'Leave' event for each field. It sounds like alot of overhead, but in actuality, it is very quick, simple and extremely convenient for my users.
Pat
|
|
|
|
|
Capilano wrote:
I won't bore you with the syntax of the actual EditALLFields function, but if necessary, I can.
This is EXACTLY what we need!
|
|
|
|
|
Here is the Function:
Public Function EditALLFields(ByVal sID As String, ByVal sValue As String, ByVal sTable As String, ByVal sField As String, ByVal sIDField As String, ByVal sType As String)
Dim cmdSaveCurrentField As SqlCommand = New SqlCommand
Try
If CN.State = ConnectionState.Open Then
Else
CN.Open()
End If
With cmdSaveCurrentField
.Parameters.Clear()
.Connection = CN
.CommandText = "SaveFields"
.CommandType = CommandType.StoredProcedure
'Matches up to value of ID field at very beginning of row
.Parameters.Add("@sID", SqlDbType.VarChar, 255).Value = sID
'Is the new data value entered
.Parameters.Add("@sValue", SqlDbType.VarChar, 4000).Value = sValue
'Name of Table you are updating
.Parameters.Add("@sTable", SqlDbType.VarChar, 255).Value = sTable
'Name Field you are updating
.Parameters.Add("@sField", SqlDbType.VarChar, 255).Value = sField
'name of IDField for the Table
.Parameters.Add("@IDField", SqlDbType.VarChar, 255).Value = sIDField
'Type is data type
.Parameters.Add("@sType", SqlDbType.VarChar, 255).Value = sType
.ExecuteNonQuery()
End With
Catch ex As Exception
MsgBox(ex.Message)
Finally
cmdSaveCurrentField = Nothing
If CN.State = ConnectionState.Open Then
CN.Close()
End If
End Try
End Function
|
|
|
|
|
With what you've described and what you posted as your code, it's not this code that breaking. Instead, it would appear that it's your stored procedure, SaveFields, that's breaking.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Yes, I had thought of that too. But after some testing, we quickly realized that the original code was actually sending two choices. Subsequently, we worked on the function side and came up with this solution:
If InStr(sValue, "'", CompareMethod.Text) > 0 Then sValue = Microsoft.VisualBasic.Left(sValue, InStr(sValue, "'", CompareMethod.Text) - 1) & "'" & Microsoft.VisualBasic.Right(sValue, sValue.Length - InStr(sValue, "'", CompareMethod.Text) + 1)
End If
This seems to work well.
Thanks for your advice.
Pat
|
|
|
|
|
Here's my delima. I have a web form that inserts data into a SQL database via a stored procedure. I have 64 columns per row. The data can only be inserted/viewed but not deleted or updated. Is there a better way of updating 64 fields without having to assign the value of Textbox.Text directly? Here's what I'm doing it currently:
submitEPARControl.ascx.vb (Fieldnames changed for security):
Private Sub lbSubmit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lbSubmit.Click
Dim newRow As DataRow
Dim strUIC As String
Dim ds As New DataSet
Dim di As New DataInterface
If Page.IsValid Then
ds = di.CreateEmptyDataSet
ds.Tables(0).TableName = "Table"
newRow("Field1") = Field1.Text
newRow("Field2") = Field2.Text
newRow("Field3") = Field3.Text
ds.Tables(0).Rows.Add(newRow)
di.AddData(ds)
Else
End If
End Sub
DataServices.vb:
Public Function AddData(ByRef dsAddition As DataSet)
Dim db As Database = DatabaseFactory.CreateDatabase()
Dim dbCommandWrapper As DBCommandWrapper = db.GetStoredProcCommandWrapper("MyStoredProc")
dbCommandWrapper.AddInParameter("@Field1", DbType.String, "Field1", DataRowVersion.Proposed)
dbCommandWrapper.AddInParameter("@Field2", DbType.String, "Field2", DataRowVersion.Proposed)
dbCommandWrapper.AddInParameter("@Field3", DbType.String, "Field3", DataRowVersion.Proposed)
Return db.UpdateDataSet(dsAddition, dsAddition.Tables(0).TableName, dbCommandWrapper, Nothing, Nothing, UpdateBehavior.Continue)
End Function
- Paul Davis
|
|
|
|
|
I don't know for sure, but it looks like your adding the data to your DataTable object, then writing that same data back to the database using a stored procedure. Could you get away with just adding the data to the database with the stored procedure, then reload your DataTable? If the data you're retrieving is small enough this wouldn't be a problem. But if your DataTable holds thousands of rows, how your doing it would probably be the best way.
In either case, you can't do it with less code. And frankly, from what you've posted, I don't think your using enough code! Are you validating and normalizing your data before you add it to the database or are you letting your stored procedure add it?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
At this point, the application is not in production. I have not yet added the validation code. However, that is my next step if this way of adding the data is the final way.
All my background is with unix/windows applications (mostly C/C++). Guess I was hoping for a cleaner way of doing it using bindings since I'm only adding one row at a time. I will be moving the commandwrapper to the submit event and add the data using the StoredProcedure directly as you suggested. That will clean up some.
Thank you for the response!
- Paul Davis
|
|
|
|
|
hi guys,
i've datagrid in my windows form and i've implemented combobox in one of the datagrid column. Now my problem is tht when i click on tht text of the comboboxcolumn it converts into dropdown and if i click it again it opens and show me all the available values. so in this case to see and select the value i have to click it twice. but i need to do it with one click. how can i do tht.
Or there is an another option but i dont know how to implement it. it is like when i bind my grid every row should have the combobox for a perticular column. ie. every combo should remain forever unlike in the normal case when it comes only when u try to edit a perticular row.
plz give me some solution..
thnx in advance
A R MOGHE.
|
|
|
|
|
...so in this case to see and select the value i have to click it twice. but i need to do it with one click. how can i do tht.
i've never done but try to handle the "VisibleChanged" event in your columnstyle and popup the combobox.
...it is like when i bind my grid every row should have the combobox for a perticular column. ie. every combo should remain forever unlike in the normal case when it comes only when u try to edit a perticular row.
your DatagridComboboxColumn has one instance of your combobox and shows it until one cell will be edited. if you like to show the combobutton in each cell of your column you have to draw it you own. you can use
system.Windows.Forms.ControlPaint.DrawComboButton
in your onPaint method
good luck
|
|
|
|
|
Thanks buddy for ur kind information, i really appriciate ur help..
A R MOGHE.
|
|
|
|
|
The project I am working on was built to be used in conjunction with a touchscreen, but due to cost, it now has to work with a regular keyboard and mouse as well. Due to the nature of the project, I have to be able to prevent a user from leaving the application and having access to windows.
How would I capture keys such as Ctrl+Alt+Delete and prevent the default behavior? I will also need to prevent Alt+Tab, the windows key, etc.
I believe I know how to do the capture....
Private Sub Form1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles MyBase.KeyPress
'Ctrl keypress
If e.KeyChar = ChrW(17) Then
'then what?
End If
End Sub
Really going to need some help here..
Has anyone done something similar?
|
|
|
|
|
Have also tried:
If Control.ModifierKeys = Keys.ControlKey Then<br />
e.Handled = True<br />
Microsoft.VisualBasic.Interaction.Beep()<br />
End If<br />
If Control.ModifierKeys = Keys.Alt Then<br />
e.Handled = True<br />
Microsoft.VisualBasic.Interaction.Beep()<br />
End If<br />
If Control.ModifierKeys = Keys.Control Then<br />
e.Handled = True<br />
Microsoft.VisualBasic.Interaction.Beep()<br />
End If<br />
If Control.ModifierKeys = Keys.Escape Then<br />
e.Handled = True<br />
Microsoft.VisualBasic.Interaction.Beep()<br />
End If<br />
If Control.ModifierKeys = Keys.RWin Then<br />
e.Handled = True<br />
Microsoft.VisualBasic.Interaction.Beep()<br />
End If<br />
If Control.ModifierKeys = Keys.LWin Then<br />
e.Handled = True<br />
Microsoft.VisualBasic.Interaction.Beep()<br />
End If
but the default behavior still runs
|
|
|
|
|
There is no way to stop Ctrl-Alt-Delete or Alt-Tab or any other system combination from popping up from your code. Those key combinations are handled by the system before your app even knows that the final key in the combination was even pressed. For example, your app will known that Ctrl and Alt are held down, but will never see the Del key. It will know that Alt is down, but not the Tab key.
Most of these things are best handled by modifying Group Policy on the machine. Some, like disabling the Windows key are better left to a C++ app that uses a low-level keyboard hook and eats certain keys.
Still, there's no way to stop Ctrl-Alt-Del from popping up. But, by using Group Policy, you can stop everything the user can do in the dialog that pops up. I would HIGHLY suggest picking up the Resource Kit for what OS your using for your kiosk. It'll prove to be invaluable in a case like this.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Found an article on Managing Low-Level Keyboard Hooks in VB .NET:
http://www.developer.com/net/vb/article.php/10926_2193301_3[^]
The code works great... but needs some working on..
I am currently using it to successfully block:
Ctrl+Escape
Alt+Tab
Alt+Escape
Alt + F4
And the Right/Left Windows keys
Just need to get Ctrl+Alt+Delete...
I don't doubt that "key combinations are handled by the system before your app even knows that the final key in the combination was even pressed" , but somehow this module seems to work, doing just that(?).
Maybe if you had a look at the article?
|
|
|
|
|
I know for a fact that there is absolutely no way on earth you're going to trap Ctrl-Alt-Delete. Unless of course, you replace the GINA.DLL (don't even bother). You can't stop it from popping up, but you can block the actions that can be taken inside the dialog using Group Policies (Start/Run - gpedit.msc.)
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Yeah, was just reading that on MSDN....
Gina isn't an option....
now have to modify the registry...
Ugh
HKCU\
Software\
Microsoft\
Windows\
CurrentVersion\
Policies\
System\DisableTaskMgr = dword:1
thanks
|
|
|
|
|
Hi All,
Could anybody help me out in identifying the association between the
.NET's ReleaseComObject() method and the Dispose Pattern? Are they are
similar things and serves the same purpose. Are they substitute of each
other?
This issue has become really hot for our project. Itwill be really
great if the xpert people can provide their corresponding usage for
real world applications. Differences/ Similarties between them and what
exactly they serves?
Please share your expertise and provide me some good database of
knowledge.
Thanks in advance.
Deeps
|
|
|
|
|