|
Hi, Sorry, perhaps I am saying the wrong thing, I am not too familiar with e-mail sever lingo. Basically we used a different mail server to send it off (which i specify as a new smtp client I.p address) and then it did not compress the file. It sends through code to pc's using outlook. But when using the first smtp client I.p (server1) address it zipped the file. On the second I.p (server 2) it didn't. Thats why I can only assume something on the first mail sever is compressing the files when sending
|
|
|
|
|
That makes more sense now. You used a different email server and now it works.
Well then, you will need to find out the type of server, and look up the documentation to find out if there are options to turn off automatic compression of attachments.
There may also be a custom parameter value that you can pass in with the message from the client, to turn this on/off on a message by message basis, but you will need to go and investigate, as i have no idea what type of mail server you are using!
|
|
|
|
|
Thanks,
I'll take a look and see if I can find anything. Unfortuanately the mail server is administered by a different company but I mainly wanted to establish that it was not something on my side, rather something with their server.
Thanks for the help.
|
|
|
|
|
Hi,
I like to know to split a string value from a mixed value
suppose
dim MyValue as string ="CodePr1"
Now I need to seperate the string part like "CodePr"
Is there any short ideas?
Thanks
|
|
|
|
|
I just did this off the top of my head. I don't know if there is a .net function for this.
Private Function SplitStringAtFirstNumeral(ByVal mystring As String) As String()
Dim myArray(1) As String
Dim i As Integer = 0
For Each ch As Char In mystring
If IsNumeric(ch) Then
myArray(0) = mystring.Substring(0, i)
myArray(1) = mystring.Substring(i, mystring.Length - i)
Exit For
End If
i += 1
Next
Return myArray
End Function
If anyone has a better way please let me know.
|
|
|
|
|
I did the same way which one you gave. But looking for DotNet any direct commands.
|
|
|
|
|
Take a look here[^] for all the possibilities with the String class; you may need to use more than one method to achieve the desired result.
MVP 2010 - are they mad?
|
|
|
|
|
I wanna know how to insert both username and password into my database using the vb.net
I just wanted to create a "Create An Acount" form
whereby the button can actually insert the username and the password into my database
any1 can guide me on this?
Thanks,
|
|
|
|
|
To communicate with any database with vb.net requires the use of ADO.net. To communicate with a MySQl database requires the use of the MySql
connector/net which can be found here http://www.mysql.com/products/connector/[^]. To insert records into your database will require the use of SQL. I suggest you read this article ADO.NET For Beginners[^] and then buy any decent beginners VB.net book which should teach you these three fundamental principles. If you have started an approach to this problem and are stuck with a specific programming question then I will be more than willing to help further.
|
|
|
|
|
i need some help with this source code that i have,
ok wat i wan is when i click on the button on the form it can help me create a new account and both the username and the password will be store in the database.
Imports
System.Data.SqlClient
Public Class Form2 Inherits System.Windows.Forms.Form
Dim myConnection As SqlConnection
Dim myCommand As SqlCommand
Dim ra as Integer
'integer holds the number of records inserted
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e_
As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e_
As System.EventArgs) Handles Button1.Click
myConnection = New SqlConnection("server=localhost;uid=sa;pwd=;database=pubs")
'you need to provide password for sql server
myConnection.Open()
myCommand = New SqlCommand("Insert into Jobs values 12,'IT Manager',100,300,_
myConnection)
ra=myCommand.ExecuteNonQuery()
MessageBox.Show("New Row Inserted" & ra)
myConnection.Close()
End Sub
End Class
|
|
|
|
|
Okay, for the sake of simplicity I will assume you have a User class in your project with public properties UserName and Password. In this class you need to create a constructor that accepts a parameter for the username and one for the password (I would hope the password is encrypted) i.e
Public Sub New(ByVal Name As String, ByVal Pass As String)
UserName = Name
Password = Pass
End Sub
You then need to create a function that saves your user i.e
Public Function SaveUser() As Integer
Dim conDB As New MySqlConnection("server=localhost;uid=sa;pwd=;database=pubs")
Dim myCon As New MySqlCommand
myCon.CommandText = "INSERT INTO Users (Username, PassWord) VALUES (@Username,@Password)"
myCon.Connection = conDB
myCon.Parameters.AddWithValue("@Username", UserName)
myCon.Parameters.AddWithValue("@Password", Password)
Dim intResult As Integer = 0
conDB.Open()
intResult = myCon.ExecuteNonQuery
conDB.Close()
Return intResult
End Function
in your Button.Click event you can just do this,
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim newUser As New User(txtUserName.Text, txtPassword.Text)
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim newUser As New User(txtUserName.Text, txtPassword.Text)
If newUser.SaveUser() = 0 Then
MsgBox("User Not Saved")
Else
MsgBox("User Successfully Saved")
End If
End Sub
End Sub
modified on Thursday, January 21, 2010 7:04 AM
|
|
|
|
|
I'm in VS2008 and as I debug my project the memory use of devenv keeps increasing until it takes up all of my memory. This never happened in VS2005. Any ideas appreciated.
|
|
|
|
|
Does this kind of thing happen when you run the application in 'go live' mode?
Now...bring me that horizon. And really bad eggs...Drink up me hearties, YO HO!
|
|
|
|
|
|
You did buy all the memory, why are you hoping it doesn't get used?
Good software takes advantage of available memory, while being willing to give up a lot of it when requested to do so. In that sense VS2008 and Vista are good. They both object to memory holding "nothing". They keep data around like a cache.
Experiment: start two instances of Visual Studio and have them both do whatever it was you did with one VS. Each of them will be slightly slower and use less memory than the single one did.
Of course, there are also other ways to really waste memory (e.g. memory leaks), where the user is not getting any advantage. Memory wasted like that is unlikely to be recoverable (try minimizing your app and watch what TaskManager says about the working set; mind you, TaskManager is not a very good indicator).
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that. [The QA section does it automatically now, I hope we soon get it on regular forums as well]
|
|
|
|
|
OK, but I still don't see why VS2008 should not give memory back. Each time I start the solution more memory is taken by the program. Stopping the program or minimizing it does not give memory back. Eventually Task Manager shows the private working set at almost 2G. Is this really normal behavior?
ty
|
|
|
|
|
That does not sound all right. It may be a bug in VS. I'm not aware of such bug though.
You are aware Visual Studio executes some of your code (such as Form constructors) while you are designing your Forms, so any memory leaks you have in such code would accumulate.
Does the memory situation deteriorate when you run your app to completion? or only when it crashes, or you stop the execution prematurely by hitting the "Stop Debugging" menu/icon/key combination?
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that. [The QA section does it automatically now, I hope we soon get it on regular forums as well]
|
|
|
|
|
What's very strange is that the memory use does not increase significantly while I'm running the program but only after I stop it. Within a few seconds after the program stops (no matter whether it breaks or finishes) the memory use goes up substantially.
|
|
|
|
|
Very strange indeed. Never seen such a phenomenon.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that. [The QA section does it automatically now, I hope we soon get it on regular forums as well]
|
|
|
|
|
Dear developers,
I have problem in calling function from module in access 2007.
1. Let's see my code:
Public Function insertDB(tblName As String, tblField As String, strValue As String, db As ADODB.Database)
Dim Str As String
Dim Rst As New ADODB.Recordset
Rst.CursorLocation = adUseClient
Str = "Insert into" & tblName & "(& tblField &)" & " Values(" & strValue & ")"
db.Execute Str
End Function
Is it the correct function???
2. How to call this function in the form??
Cheers,
Visoth
Chuon Visoth
Angkor Wat - Cambodia
asp.net - c sharp beginner
|
|
|
|
|
It's close to being right...
misCafe wrote: Str = "Insert into" & tblName & "(& tblField &)" & " Values(" & strValue & ")"
Should be:
Str = "Insert into" & tblName & " (" & tblField ") Values(" & strValue ")"
Of course, this method needs a little more looking at, as you will need to ensure that your strValue parameter includes single quotes around the string you are inserting (if it's a string).
You would call this function from the form perhaps via the On Click event of a button.
|
|
|
|
|
The function does not actually return anything and therefore should be a sub rather than a functions
Steve Jowett
-------------------------
Real programmers don't comment their code. If it was hard to write, it should be hard to read.
|
|
|
|
|
Can you correct this function for me?
What's more, I do not how to write code to call this function too.
Chuon Visoth
Angkor Wat - Cambodia
asp.net - c sharp beginner
|
|
|
|
|
Hi guys,
This is my first posting on here, be gentle!
Bit of a novice really but need some help.
I'm re-doing a work's Document Repository and I need the following out of this bit of code:
- List a folder contents: Done
- Import the folder contents to an array list: Done
- Extract the Name, FullName and CreationDate only: Need Help
- Make the FullName a clickable Hyperlink: Need Help
- Export the Name, CreationDate and FullName Hyperlinks to Excel: Need Help
Thanks to you all! Keep up the good work on this site.
Cav
The code snipet so far is below:
-------------------------------------------------------------------------------------------------------
Public Class frmMain
Dim hyperarray As New ArrayList
Private m_da_Addresses As OleDbDataAdapter
Private m_DataSet As DataSet
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBrowseOpen.Click
Dim basepath As String
Dim array As New ArrayList
' Declare a variable named theFolderBrowser of type FolderBrowserDialog.
Dim theFolderBrowser As New FolderBrowserDialog
' Set theFolderBrowser object's Description property to
' give the user instructions.
theFolderBrowser.Description = "Please select a folder for the download."
' Set theFolderBrowser object's ShowNewFolder property to false when
' the a FolderBrowserDialog is to be used only for selecting an existing folder.
theFolderBrowser.ShowNewFolderButton = False
' Optionally set the RootFolder and SelectedPath properties to
' control which folder will be selected when browsing begings
' and to make it the selected folder.
' For this example start browsing in the Desktop folder.
theFolderBrowser.RootFolder = System.Environment.SpecialFolder.Desktop
' Default theFolderBrowserDialog object's SelectedPath property to the path to the Desktop folder.
theFolderBrowser.SelectedPath = My.Computer.FileSystem.SpecialDirectories.Desktop
' If the user clicks theFolderBrowser's OK button..
If theFolderBrowser.ShowDialog = Windows.Forms.DialogResult.OK Then
' Set the FolderChoiceTextBox's Text to theFolderBrowserDialog's
' SelectedPath property.
tbOpenFolder.Text = theFolderBrowser.SelectedPath
basepath = theFolderBrowser.SelectedPath
End If
RecursiveSearch(basepath, array)
End Sub
Private Sub RecursiveSearch(ByRef basepath As String, ByRef array As ArrayList)
Dim int As Integer = 0
Dim dirInfo As New IO.DirectoryInfo(basepath)
' Try to get the files for this directory
Dim pFileInfo() As IO.FileInfo
Dim ooo As String
ooo = dirInfo.FullName
Try
pFileInfo = dirInfo.GetFiles()
Catch ex As UnauthorizedAccessException
MessageBox.Show(ex.Message, "Exception!", MessageBoxButtons.OK, MessageBoxIcon.Error)
Exit Sub
End Try
' Add the file infos to the array
array.AddRange(pFileInfo)
WriteToText(array)
' Try to get the subdirectories of this one
Dim pdirInfo() As IO.DirectoryInfo
Try
pdirInfo = dirInfo.GetDirectories()
Catch ex As UnauthorizedAccessException
MessageBox.Show(ex.Message, "Exception!", MessageBoxButtons.OK, MessageBoxIcon.Error)
Exit Sub
End Try
' Iterate through each directory and recurse!
Dim dirIter As IO.DirectoryInfo
For Each dirIter In pdirInfo
hyperarray.Add(dirInfo.FullName)
RecursiveSearch(dirIter.FullName, array)
Next dirIter
End Sub
Private Sub WriteToText(ByRef array As ArrayList)
dgvFiles.DataSource = array
ListBox1.DataSource = hyperarray
End Sub
-------------------------------------------------------------------------------------------------
|
|
|
|
|
cavana1 wrote: Extract the Name, FullName and CreationDate only
Look at System.IO.FileInfo
for example :-
Dim myFile as System.IO.FileInfo("C:\MyFolder\MyFile.txt")
then look at the properties of myFile
cavana1 wrote: Export the Name, CreationDate and FullName Hyperlinks to Excel
You could create an HTML file but with at extension .xls
The file should contain a table, and Excel will then read it in as an spreadsheet.
for example
<html>
<head />
<body>
<table>
<tr>
<td>File name</td>
<td>Created</td>
<td>Full Path</td>
</tr>
<!-- Add a section as follows for each file -->
<tr>
<td>MyFile.xls</td>
<td>01/01/2010 09:00:00</td>
<td><a href="File://C:\MyFolder\MyFile.txt">C:\MyFolder\MyFile.txt</a></td>
</tr>
<!-- end of section -->
</table>
</body>
</html>
Steve Jowett
-------------------------
Real programmers don't comment their code. If it was hard to write, it should be hard to read.
|
|
|
|
|
Hi Friends,
I have created one ocx file in visual basic 6.0.
It is doing some process finally it will print one text.
Is there anyway to return that text as picture so that I can capture it
from the external application.
thanks in advance..
|
|
|
|