|
It would be better to ask your question in the ASP.NET or Web Development forums
Steve Jowett
-------------------------
Real programmers don't comment their code. If it was hard to write, it should be hard to read.
|
|
|
|
|
does anyone know how to pass a value from word document to a text box?
thanks in advance..
yours truly,
hyperalergelo
|
|
|
|
|
You can examine word documents using the Office Tools for .NET to interop with Word.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
yes i know, but i'm having trouble using this..
txtResult.Text = activeDoc.Content.Sentences.Item(1)
and this one
txtResult.Text = activeDoc.Content.characters.Item(1)
got any other idea what to use to get value from word document?
yours truly,
hyperalergelo
|
|
|
|
|
I am getting this error on the above code..
Unable to cast COM object of type 'System.__ComObject' to class type 'System.String'. Instances of types that represent COM components cannot be cast to types that do not represent COM components; however they can be cast to interfaces as long as the underlying COM component supports QueryInterface calls for the IID of the interface.
yours truly,
hyperalergelo
|
|
|
|
|
problem solved..
I'll post it for future reference..
Imports Word = Microsoft.Office.Interop.Word
Imports Office = Microsoft.Office.Core
Partial Class _Default
Inherits System.Web.UI.Page
Private objMisc As New Miscellaneous
Private WordApp As New Word.ApplicationClass()
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
End Sub
Protected Sub btnSave_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSave.Click
'objMisc.InsertCV("E:\CVParser\CVParser\Files\" & OFDCV.FileName)
' set the file name from the open file dialog
Dim aDoc As Word.Document
Dim fileName As Object = OFDCV.PostedFile.FileName
Dim [readOnly] As Object = False
Dim isVisible As Object = True
Dim fileToOpen As Object = DirectCast("c:\sample.doc", Object)
' Here is the way to handle parameters you don't care about in .NET
Dim missing As Object = System.Reflection.Missing.Value
' Make word visible, so you can see what's happening
WordApp.Visible = False
' Open the document that was chosen by the dialog
aDoc = WordApp.Documents.Open(fileName, missing, [readOnly], missing, missing, missing, missing, missing, missing, missing, missing, isVisible) ' Activate the document so it shows up in front aDoc.Activate();
txtResult.Text = aDoc.Content.Text
aDoc.Close(missing, missing, missing)
WordApp.Quit(missing, missing, missing)
End Sub
End Class
yours truly,
hyperalergelo
|
|
|
|
|
im running this function to convert a list of code into a certain standard.. the problem is, when i choose the files (where i get the value of coop) and directory (where i compare coop with the list in the directory) this msg come out "index out of range exception". But if i choose local file and directory example file from my desktop and my d:/ there's np error.. but if i choose the file from other map drive the error happen at the Catch part.
Private Sub SEMAK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SEMAK.Click
Dim fileName As String = TextBox1.Text.Trim
Dim lineNumber As Integer = 0
Dim sr As StreamReader = New StreamReader(fileName)
Dim conn As New SqlClient.SqlConnection("Data Source=10.0.0.70;User ID= sysadm;Password=sysadm;Initial Catalog=SPGA_Latihan;Persist Security Info=True;")
Dim tarikh As String = ""
Dim runNo As String = ""
Dim coop As String = ""
Dim line As String = ""
Do
line = sr.ReadLine()
If line <> Nothing Then
Try
tarikh = line.Substring(0, 8).Trim()
runNo = line.Substring(9, 5).Trim()
coop = line.Substring(15).Trim()
Catch ex As Exception
Console.Write(ex.ToString())
End Try
Dim strSQL As String = "INSERT INTO portal (tarikh,runNo, coop) VALUES (@tarikh, @runNo, @coop)"
Dim cmd As New System.Data.SqlClient.SqlCommand(strSQL, conn)
conn.Open()
cmd.Parameters.Add(New SqlClient.SqlParameter("@tarikh", SqlDbType.Char, 8))
cmd.Parameters("@tarikh").Value = tarikh
cmd.Parameters.Add(New SqlClient.SqlParameter("@runNo", SqlDbType.Char, 20))
cmd.Parameters("@runNo").Value = runNo
cmd.Parameters.Add(New SqlClient.SqlParameter("@coop", SqlDbType.VarChar, 100))
cmd.Parameters("@coop").Value = coop
cmd.ExecuteNonQuery()
conn.Close()
Dim dirB1 As DirectoryInfo = New DirectoryInfo(TextBox2.Text)
Try
convertCoop(coop)
Dim dA1 As DirectoryInfo
Dim dirB2 As FileSystemInfo() = dirB1.GetDirectories
Dim strSQL2 As String = "SELECT folder, portal FROM kodPortal"
Dim cmd2 As New System.Data.SqlClient.SqlCommand(strSQL2, conn)
For Each dA1 In dirB2
If dA1.Name = portal Then
Dim dA2 As DirectoryInfo
Dim dirB3 As FileSystemInfo() = dA1.GetDirectories
For Each dA2 In dirB3
If dA2.Name = "Fail_Bayaran" Then
Dim dA3 As DirectoryInfo
Dim dirB4 As FileSystemInfo() = dA2.GetDirectories
For Each dA3 In dirB4
If dA3.Name = coop Then
Dim dA4 As FileSystemInfo
Dim dirB5 As FileSystemInfo() = dA3.GetFileSystemInfos
For Each dA4 In dirB5
If dA4.Name <> runNo Then
MsgBox(coop)
End If
Next dA4
End If
Next dA3
End If
Next (dA2)
End If
Next dA1
Catch ex As Exception
End Try
End If
Loop Until line Is Nothing
sr.Close()
End Sub
Private Sub convertCoop(ByVal coop As String)
Dim conn1 As New SqlClient.SqlConnection("Data Source=10.0.0.70;User ID= sysadm;Password=sysadm;Initial Catalog=SPGA_Latihan;Persist Security Info=True;")
Dim comm As SqlClient.SqlDataAdapter = Nothing
Dim ds As DataSet = New DataSet()
Try
Dim strSQL2 As String = "SELECT folder, portal FROM kodPortal WHERE folder ='" & coop & "'"
conn1.Open()
comm = New SqlClient.SqlDataAdapter(strSQL2, conn1)
comm.Fill(ds, "kodPortal")
portal = ds.Tables(0).Rows(0).Item("portal")
conn1.Close()
Catch ex As Exception
MsgBox(ex.Message)
Finally
If Not conn1 Is Nothing And conn1.State = ConnectionState.Open Then
conn1.Close()
End If
conn1 = Nothing
comm = Nothing
End Try
End Sub
|
|
|
|
|
Have you bothered to walk through the code in te debugger ? I assume this means you're not getting any data back from your database.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
i am using the debugger.. the thing is, i can read data from the files but when it comes to this part in convertCoop, i cannot get value from "portal" but the value of "coop" is ok. after this part, at the Catch part, the msg "index out of range exception" come out. is it bcoz the directory that i choose got a lot (thounsands) of folder n files? bcoz when i choose directory that only have a few folders n files, it runs smoothly.. no errors, and i can see all the missing files in that directory.
portal = ds.Tables(0).Rows(0).Item("portal")
|
|
|
|
|
Have you remembered that the index for substring starts at 0, therefore SubString(15) would return the string from the 16th character of the string.
Steve Jowett
-------------------------
Real programmers don't comment their code. If it was hard to write, it should be hard to read.
|
|
|
|
|
i dont have any problems with my substring.. i can read data from file using that code.. as u can see my reply at Christian answers, the problem start if i choose directory that have thousands of folder n files. but if a choose a directory that have just a few folder n files.. it can run and can get output from the prgm..
|
|
|
|
|
Hi to Everyone,
As per my client request, I want to kill/hide the process the start bar, on the application start-up.And show it (start the process again)on application ends. Not only the menu, but the full bar itself.
Could anyone please tell me how to do that?
Thanks in advance
<div class="ForumMod">modified on Thursday, March 19, 2009 2:45 AM</div>
|
|
|
|
|
You writing a virus are you?
|
|
|
|
|
I am sorry, But I am not..
I have a vb.net application to be given to client. For security reason,I need to disable all possible options, so that the user cannot access anything in the system when the application is running...I have disabled the special keys,...and made the form to cover the monitor.. But sometimes the task bar comes up, top of the form. Hence I need to hide the task bar till my application runs..
May be not kill, but to hide..Also I need to know how to unhide(show) it back....
I think if I kill the explorer.exe does it... But need to know how to kill it
I am a beginner
|
|
|
|
|
himangshuS wrote: I have a vb.net application to be given to client
himangshuS wrote: I am a beginner
I am so sick of this. You want to write a complex application, that does something quite difficult. You have a client. You are a beginner. Did you tell your client that you are a beginner, or did you assure them that for $5.28 you could write exactly what they need, expecting that you could just come here, and we'd do your work for you ?
You are a disgrace. You should tell your client that you are a liar and a thief.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Thanks for your suggestion Mr. Christian....
But may be I wont appreciate that.
To make it more clear, I am doing a small application for my friend's office. Thats whom I called as client. I never thought I need to discuss this.
And about the beginner. I am. I am doing this project, so that I can learn. Hence Proudly I can say I am a beginner learner.
And about the complexity of a project, I really don't think so a beginner can not go ahead to learn and do any staff. I swear I didn't born with that talent.
I have a good opinion about this forum. and I respect all here.
Also, could you please tell me how exactly you differentiate "clearing somebody's doubt" and "doing somebody's work" in a forum
Thank you once more for your suggestion.
I am a beginner
|
|
|
|
|
himangshuS wrote: Also, could you please tell me how exactly you differentiate "clearing somebody's doubt" and "doing somebody's work" in a forum
I respect the fact that you've come back to me in the way you have. However, these forums are full of people who have no interest in learning, and the easiest way to tell them, is that they are doing a complex task and say 'I am a beginner'. As to your question - usually the way to tell the difference is that people who have a doubt, post their code and ask for help. People who don't post code, generally are looking for a cut and paste solution.
What you're asking for, isn't really possible, I don't think. What programs a user can run, what things a user can do, are set by group policy by the network or local admin, not set through code by individual programs.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
thanks for your reply.
"Usually the way to tell the difference is that people who have a doubt, post their code and ask for help. People who don't post code, generally are looking for a cut and paste solution."
I dont know, when one doesnot have any idea about an concept and would need some help from a expert (ofcourse you are), what code to put it.
I was expecting an idea or a way to go ahead. Not the whole bunch of code.
Regards
HimangshuS
|
|
|
|
|
Fair enough. Like I said, it's not going to work. I can CTRL-ALT-ESC on any PC and get the task manager, and from there run explorer, if it's been stopped ( explorer is where the menu comes from ). So, you can't do what you want.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Oh I see. Thanks anyway....
-----------------------------
I am a beginner
|
|
|
|
|
Christian Graus wrote: Fair enough. Like I said, it's not going to work. I can CTRL-ALT-ESC on any PC and get the task manager
For straight out of the box implementation, yes you are right. But the is a way of suppressing Ctrl+Alt+Del key sequence as well.
Microsoft has removed the Ctrl+Alt+Del key sequence out of the keyboard API and moved it to GINA. to listen to those keys, one needs to write a replacement GINA. Writing GINA is not fun and one small mistake can screw up windows logon and locks out windows. It is not fun, and I don't recommend people do it, unless there is very compelling reason to write one. What is more is, the *user* GINA is loaded by win logon through registry key entry, which can be replaced by other GINA easily. Only one GINA can run at a single time.
GINA[^]
Yusuf
Oh didn't you notice, analogous to square roots, they recently introduced rectangular, circular, and diamond roots to determine the size of the corresponding shapes when given the area. Luc Pattyn[^]
|
|
|
|
|
You see there are crap load of people who scream at the top of their tounge to get a solution for problems they have no clue for. You seem to be eager to learn and we are here to help. Next time try to articulate your question and show what you have done and what you need help. That may yeild a better response.
As far as your question it is doable. you would need to learn a bit more about windows programming. with all respect, vb is just piece of crab. if you are looking for such serious application look to C++ as your friend.
Here are couple things to look at. I am not vb programmer, and this is converted from C++. You may have to tweak it to make it work.
Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long<br />
Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long<br />
<br />
<br />
Dim return As Long<br />
<br />
'get the Window<br />
return = FindWindow("Shell_traywnd", "") <br />
<br />
'hide the taskbar<br />
ShowWindow(return , SW_HIDE);<br />
<br />
'show th taskbar<br />
ShowWindow(return , SW_RESTORE)<br />
Yusuf
Oh didn't you notice, analogous to square roots, they recently introduced rectangular, circular, and diamond roots to determine the size of the corresponding shapes when given the area. Luc Pattyn[^]
|
|
|
|
|
thnaks I will give a try with it
-----------------------------
I am a beginner
|
|
|
|
|
himangshuS wrote: To make it more clear, I am doing a small application for my friend's office. Thats whom I called as client. I never thought I need to discuss this.
Breaks my heart. Christian was right with your limited information. Even I felt the same way in C++ forum, but your reply is quite convincing. You can expect me to answer you again somewhere. But as I pointed you last time, Be crisp with your question (May be this one is okay). Like when you are making a chat application, You would have questions on Sockets/MFC/Doc/view all at the same time. You shouldn't ask them all in one go. First you should try a simple socket, then a simple Dialog & others and ask one by one. When you integrate them you'll be again left with few questions. You are welcome to ask them again. But don't flush questions in one go. Anyway good luck for your new 'requirement'
Removing the task bar[^] Not a link to code, but another way of doing it. Requires Object-Dock appln.
He never answers anyone who replies to him. I've taken to calling him a retard, which is not fair to retards everywhere.-Christian Graus
|
|
|
|
|
thanks for your reply and suggestion. I will do that.
-----------------------------
I am a beginner
|
|
|
|
|