|
Thanks Divya,
I use VBA in Macro level..still no forms are used...
by using shell("notepad.exe") command i open the Note pad..
I need to append the data to that opened Notepad and save that file...
Help me Please..
Thanks in advance....
Thanks n Regards,
Ramya.R
-- modified at 4:10 Friday 24th February, 2006
|
|
|
|
|
this shd be useful
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnofftalk/html/office09072000.asp
|
|
|
|
|
why do u explictly need to create notepad ? coz if u want to save data from some text box then there are many file handling operations are there.
Divya Rathi
|
|
|
|
|
I make a application with a numbers of forms,
When I open the application in client computer,
I found some of them chnage their screen to higher DPI.
This affect my application label become a larger font.
Beside, A client change its window font,
It doesn't matter that I have setted the form face and the font size,
the whole view of my form style is totally changed.
So, does any method to handle these case?
Thank you!
|
|
|
|
|
It appears it is time once again to show my stupidity. I hope as i only got .net a few days ago i can be forgiven... I'm still converting my brain over from VB6.
1. I am attempting to find the .net equivalent of VB6's "Open ("C:\Text.txt") as input"... statment... basically just generic loading and saving of text and variables... if you want to give examples, lets just deem the file path as the C:\text.txt file. it getts easier than "INSERT PATH" or the like. I have found many examples in my research, but they tended to be variations, so im not sure whats what.. i really just want a simple explination with a breakdown of the parts and their functions.
2. I need to figure out how to bind Database fields to textboxes in .net.. there used to be a property for it, but that is no longer on the list. I have Office XP (2002) and intend to use access. I also have a guide that shows me how to convert access to SQL files, but thats another matter.
Any help would be much appreciated... and please think no less of me. lol The only bad thing from converting over is feeling like im back in 8th grade... (when i learnt VB6)...
"Love, Life and Option Explicit"
|
|
|
|
|
You can access files via the System.IO.File class.
Here's a quick example on how to read a text file.
Dim sr As System.IO.StreamReader
Dim text As String = String.Empty
Try
sr = System.IO.File.OpenText("c:\text.txt")
text = sr.ReadToEnd()
Catch
Finally
If (Not (sr Is Nothing)) Then sr.Close()
End Try
And right, the standard TextBox doesn't take a DataSource. You'll either have to push your database info into it yourself or use a different control.
|
|
|
|
|
just so i understand:
Dim sr As System.IO.StreamReader sets the variable sr as a file that is read.
Dim text As String = String.Empty sets the text variable to blank.
Try I assume is like a VB6 loop.
sr = System.IO.File.OpenText("c:\text.txt") reads the file.
text = sr.ReadToEnd()CatchFinally inputs the file into the variable... not sure on the CatchFinally...
If (Not (sr Is Nothing)) Then sr.Close() if the file is blank, stop.
End Try again assume is like ExitDo...
i'll look up the Try sequence.. will probably make more sense then.. i think i am getting it now... as for the Databaseing, anyone know a simple tutorial page for setting up a DB... basically i want to set up when i load the DB, it loads the information into variables. I then will use these variables for textboxes, and some sub-manipulation. (Gold + Income - Expenses)
"Love, Life and Option Explicit"
|
|
|
|
|
ThePmanLives wrote: Dim sr As System.IO.StreamReader sets the variable sr as a file that is read.
It declares a StreamReader reference variable. It has not been assigned a StreamReader object yet. So at first, it references "Nothing".
Files are read in streams. Think of a stream as an array of bytes, which could come from memory, the hard disk, floppy disk, etc.
ThePmanLives wrote: Dim text As String = String.Empty sets the text variable to blank.
Yes. It creates a string variable and immediately assigns it to a string object having no characters. "Empty" is a Shared (static in C#) property which returns a predefined empty string object.
ThePmanLives wrote: Try I assume is like a VB6 loop.
No. Keywords "Try", "Catch", and "End Try" are used together in exception handling. Any exception thrown in a Try block will get caught in the Catch block. Such as a FileNotFoundException. You should always use exception handling when working with files, because they're more likely to occur there.
The closest thing to this in VB6 is the "On Error GoTo" statement. In VB.NET, Microsoft decided to implement exception handling the same way it is done in C++, C#, and Java.
ThePmanLives wrote: sr = System.IO.File.OpenText("c:\text.txt") reads the file.
text = sr.ReadToEnd() outputs the file into the variable
Yes. Pretty easy eh?
|
|
|
|
|
Okey. makes a LOT more sense now. thanks... 1 last question though. what does the:
Finally
If (Not (sr Is Nothing)) Then sr.Close()
line do? Is it part of the try/catch? or is it just closeing the file afterward? (the main thing is the "finally". never seen that in vb6, so it must be new)
"Love, Life and Option Explicit"
|
|
|
|
|
"Finally" is part of the Try/Catch block.
The code within the Finally block always gets executed, regardless if an exception has occurred or not. The Finally code is executed after the Try block has been executed without exceptions or after the Catch block has been executed.
The reason it is needed is because the Try block code might not be fully executed because an exception can occur in the middle. This means any cleanup code at the bottom of the Try block will get skipped on exceptions. The Finally code is always executed, so its a good place to put cleanup code.
Take a look at this MSDN article for more details.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vblr7/html/vastmtrycatchfinally.asp[^]
|
|
|
|
|
Dear All,
I need to convert the Excel file in the Following format to XMl file Specified Below..Please Help me to come over from this difficulty...
Taskid Name OutlineLevel Colvalue
110i Design 3 L4_R_D04.002
111i Coding 3 L4_R_D04.004
112i Testing 3 L4_R_D04.006
<tasks>
<task Taskid="110i" Name="Design" Oulinelevel="3">
<colValue>L4_R_D04.002</colValue>
</task>
<task Taskid="111i" Name="Coding" Oulinelevel="3">
<colValue>L4_R_D04.004</colValue>
</task>
..........
</tasks>
Thanks n Regards,
Ramya.R
-- modified at 0:06 Friday 24th February, 2006
|
|
|
|
|
the error is this :
A connection was successfully established with the server, but then an error occurred during the login process. (provider: Shared Memory Provider, error: 0 - No process is on the other end of the pipe.)
its stuck when its come to Myconn.open().
whats wrong with this code?
conMyData = New SqlConnection(ConfigurationManager.AppSettings("psmConnectionString"))
cmdSelect = New SqlCommand("sp_ValidateUser", conMyData)
cmdSelect.CommandType = CommandType.StoredProcedure
parmReturnValue = cmdSelect.Parameters.Add("RETURN_VALUE", SqlDbType.Int)
parmReturnValue.Direction = ParameterDirection.Input
cmdSelect.Parameters.Add("@noPekerja", SqlDbType.VarChar)
cmdSelect.Parameters.Add("@pWord", SqlDbType.VarChar)
conMyData.Open()
cmdSelect.ExecuteNonQuery()
intResult = cmdSelect.Parameters("RETURN_VALUE").Value
conMyData.Close()
|
|
|
|
|
|
i enable the pipe name protocols but there is a new error.
A transport-level error has occurred when sending the request to the server. (provider: Shared Memory Provider, error: 0 - No process is on the other end of the pipe.)
could u check my code pliz :
conMyData = New SqlConnection(ConfigurationManager.AppSettings("psmConnectionString"))
cmdSelect = New SqlCommand("sp_ValidateUser", conMyData)
cmdSelect.CommandType = CommandType.StoredProcedure
parmReturnValue = cmdSelect.Parameters.Add("RETURN_VALUE", SqlDbType.Int)
parmReturnValue.Direction = ParameterDirection.Input
cmdSelect.Parameters.Add("@noPekerja", SqlDbType.VarChar)
cmdSelect.Parameters.Add("@pWord", SqlDbType.VarChar)
conMyData.Open()
cmdSelect.ExecuteNonQuery()
intResult = cmdSelect.Parameters("RETURN_VALUE").Value
conMyData.Close()
If intResult < 0 Then
If intResult = -1 Then
lblMessage.Text = "Username Not Registered!"
Else
lblMessage.Text = "Invalid Password!"
End If
End If
|
|
|
|
|
There's nothing wrong with the code. Your connection string is either messed up, or you still have configuration issues with your SQL Server.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
hello,,,
please can you help me about this problem cause i dont know how to save an image into the sql database and how i'm going to code for it....i'm a novice programmer and i'm eager to learn about it can please help me to solve this problem..please...
thanks
|
|
|
|
|
'This code can b used to store image in database using VB 6.0
Private Sub StoreImage(sPath As String)<br />
Dim bytBLOB() As Byte<br />
Dim intNum As Integer<br />
Dim rs as new RecordSet<br />
<br />
If (Trim(sPath) <> "") Then<br />
rs.Open "Select * From tTable1",cn,,adOpenDynamic,adLockOptimistic<br />
'Start store pic<br />
intNum = FreeFile<br />
Open sPath For Binary As #intNum<br />
ReDim bytBLOB(FileLen(Trim(sPath)))<br />
Get #intNum, , bytBLOB<br />
Close #1<br />
'End store pic<br />
rs.AddNew<br />
rs("Img").AppendChunk bytBLOB<br />
'Other Fields...."<br />
rs.Update<br />
End If<br />
End Sub<br />
<br />
Regards,
Javed
|
|
|
|
|
is it able to store the image file to a txt file? or dat file?
|
|
|
|
|
Private Sub SaveImageToSql()
'Try this example.
'This is not the best way but if you have no other way, try it.
'*********************************************
'You must StoredProcedure like this
'@Image image
'"INSERT INTO Table ([Image]) VALUES (@Image)"
'*********************************************
Dim connStr As String = "Connection String" ' Set Your Connection String
Dim filePath As String = "C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\Sunset.jpg" ' Set Your Image File Path
Dim fs As IO.FileStream = New IO.FileStream(filePath, IO.FileMode.Open, IO.FileAccess.Read)
Dim br As New IO.BinaryReader(fs)
Dim bytes() As Byte = br.ReadBytes(fs.Length)
Dim sqlImg As New SqlTypes.SqlBinary(bytes)
Dim conn As New SqlClient.SqlConnection(connStr)
Dim cmd As New SqlClient.SqlCommand("StoredProcedureName", conn)
Try
Dim sqlP As New SqlClient.SqlParameter("@Image", SqlDbType.Image)
sqlP.Value = sqlImg
cmd.Parameters.Add(sqlP)
conn.Open()
cmd.ExecuteNonQuery()
Catch ex As Exception
MessageBox.Show(ex.Message)
Finally
conn.Close()
conn.Dispose()
cmd.Dispose()
br.Close()
fs.Close()
br = Nothing
fs = Nothing
bytes = Nothing
End Try
End Sub
!alien!
|
|
|
|
|
VB.NET 2005 and SQL 2000
Does anyone know why when a column in my Db is tinyint, my datagrisview wont autoincrement it, and when it is integer, it is incremented as it should
I cant declare that column as autonumeric (datatable.columns(0).autonumeric=true) because it says a byte column cant be changed once it has data
Im having some problems with that and for now i had to change my table to int datatype instead of tinyint
It is weird because when i insert directly from sql analiser the tinyint auttonumeric does work
I hope someone can help me with this
Thank you
Alexei AR
Theres always a better way
Look for it
|
|
|
|
|
Why are you using a Byte type for an autonumber field??? It will only have 256 different values...
I don't think anyone's ever tried to use a TinyInt as an autonumber, well, maybe one. There's just no good use for it. What are you doing with this thing, anyway?
The workaround would be to inert a new, but blank, record in the database, then retrieve this new record and fill in whatever UI elements you need to with it. Let the database do the work for you.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
-- modified at 7:18 Friday 24th February, 2006
|
|
|
|
|
256 is all i need, actually less, like 100
is just for a small catalog, i know i could use int but i wanted to use tinyint
Im using datatables an dataadapters to work with data,all data displayed on a datagridview. If it is autonumeric in my DB, then it cant be null, when i insert a new record in my datagridview, it raises a no null allowed arror, and to fix that i have to manually enter a number for the ID, I just would like it to autoincrement that column automatically, just like when it is integer
As i said, i tryied, datatable.columns(0).primarykey=true but it raises an error, since it wont let me change that property once the table has been filled
Thanks for your reply
Alexei AR
Theres always a better way
Look for it
|
|
|
|
|
AlexeiXX3 wrote: i know i could use int but i wanted to use tinyint
Why?? Isn't it just easier to go with what works instead of trying to shoehorn something in that puts up such a fight?
I think you might find this[^] useful.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I just can't seem to wrap my brain around this one. (Yes I'm a Newbei, lol) I just don't understand how to click on a list item and get it to do what I want.
I've got a listview control that shows "*.url" files and I'd like the user to click on the list item (*.url) and get it to open in the WebBrowser control that's on the same form. How would I go about doing that. I'm using VS.Net 2003.
|
|
|
|
|
In the SelectedIndexChanged event for the listview:
Me.WebBrowser1.Navigate(Me.lvwLeft.SelectedItems(0).SubItems(1).Text)
This is assuming the URL is in the second column of the listview.
If the URL is in the first column of the listview:
Me.WebBrowser1.Navigate(Me.lvwLeft.SelectedItems(0).Text)
Dean
|
|
|
|