|
Hello,
I have a filestream that I am able to read only once when my program launches. If I attempt to read the line a second time, I receive the message "The process cannot access the file 'C:\IMGfromDB.BMP' because it is being used by another process." at this line of code...
fs = New FileStream(savedIMGName, FileMode.OpenOrCreate, FileAccess.Write)
I've tried the following to release the processes...
fs.Close()<br />
fs.Dispose() and
File.Delete(savedIMGName)
Thanks in advance
-- modified at 14:11 Tuesday 11th July, 2006
|
|
|
|
|
|
Hi guys
I have stored a treenode text into a custom property then now i want to reselect the specified treenode whenever i start my application.
So plz guys help me out n tell me which code to use.
Thanks in advance.
MAP Tiger
Tiger Softwares
Software Designer and Developer
VB.NET, ASP.NET, VFP
|
|
|
|
|
Hi all,
I'm not much of a VB programer so I hope one of you guys or gals could help me with something. I am trying to create a macro to be used with word. The pupose is to search the selected text for a character sequence and edit it. If you know anything about chinese, this macro will convert numbered pinyin into toned pinyin.
it looks something like this
Sub number2tone()
With Selection.Find
.Text = "r1"
.Replacement.Text = "1r"
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "r2"
.Replacement.Text = "2r"
End With
Selection.Find.Execute Replace:=wdReplaceAll
...
With Selection.Find
.Text = "a4"
.Replacement.Text = ChrW(&HE0)
End With
Selection.Find.Execute Replace:=wdReplaceAll
End Sub
The problem I am having is that instead of searching only the selected text, sometimes it goes on to the end of the document and sometimes to the end of the line.
|
|
|
|
|
stored procedure concepts in vb.net
|
|
|
|
|
can you be a bit more specific please?
|
|
|
|
|
Is this a question, a statement, or just a general thought ? I suspect if you wanted info on this, pasting it into google verbatim will give you plenty.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Hi, I am creating a front-end to the sqlite DBMS using VB.Net 2002. I have managed to get the name of the table, field names and types from user input displayed into a listview but I can only get the Create table command to accept the last input values, so if the table has more than one field(which nealry every table has) it simply ignores the previously entered fields.
How would I get it to create an SQL query with all the inputted field details?
I have inserted the code I have used so far.
Many thanks for your help.
This button opens up a new form for the user to input the field name and select the field type then brings them back and displays them in a listview.
Public Sub btnAddColumn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAddColumn.Click
Dim frmAddColumns1 As New frmAddColumns()
frmAddColumns1.ShowDialog(Me)
fldName = frmAddColumns.ColumnNameTB.Text
fldAttribute = frmAddColumns.ColumnTypeTB.SelectedItem
'Create ListViewItem
Dim item1 As New ListViewItem(fldName, 0)
item1.SubItems.Add(fldAttribute)
'Add the items to the ListView.
listView1.Items.AddRange(New ListViewItem() {item1})
Me.Controls.Add(listView1)
End Sub
This button takes the input table name, field name and attributes and creates the SQL command to send to the database to create the table:
Private Sub btnCreateTable_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCreateTable.Click
Dim tblName As String
tblName = txtTableName.Text.ToString()
If Len(txtTableName.Text) < 1 Then
MessageBox.Show("Please type a name for the table")
ElseIf Len(txtTableName.Text) > 0 Then
Try
dbConn.openExistingDatabse("Data Source=" & getDBName() & ";Version=3;New=False;Compress=True;")
dbConn.createSQLCommand()
dbConn.createTable("CREATE TABLE " & tblName & "(" & fldName & " " & fldAttribute & ")")
MessageBox.Show("Table created successfully")
Me.Close()
Dim frmInsertData1 As frmInsertData = New frmInsertData()
frmInsertData1.Show()
Catch es As Exception
MessageBox.Show(es.Message)
End Try
End If
End Sub
|
|
|
|
|
In btnAddColumn_Click() you assign fldName and fldAttribute and add them to the ListView but in btnCreateTable_Click() you don't iterate the ListView to retrieve all added columnnames and datatypes. You only use the las assigen values for fldName and fldAttribute.
BR
Fredrik
-- modified at 10:05 Wednesday 12th July, 2006
|
|
|
|
|
Hi Fredrik, thanks for your help, I've managed to get all rows from the listview using a for loop and adding them to a string.
thanks again for your help
john
|
|
|
|
|
I had created a vb script file
I want to execute the script file , before of after installing
the applicaion.
how to run vb script form setup using Visual Studio
Setup & deployment wizard
Thanks in Advance
|
|
|
|
|
hi,
i want to print the report using crystal report.
but the layout which i want should be displayed in Boxes.
Plz give me suggestion and code.
thanks
Parag
S/w Engineer
|
|
|
|
|
U can use field format option by right click on field in Detaile Saction.
This may solve ur prblm.
|
|
|
|
|
hellow to all
i am trying to add the Microsoft Outlook 11.0 Object Library reference to my project , but i can't find it in the COM , where can i find it ?
thxx
|
|
|
|
|
Do you have Office 2003 installed on the machine that you're using Visual Studio with?
I recently went through an MSDN call regarding a problem with my application working with different versions of Office, and they said that you need to install the version of Office you want the application to work with on the development box to get the reference.
Hope this helps...
Lost in the vast sea of .NET
|
|
|
|
|
Hi,
Does anyone know any api that could replace hex character?I want to replace null character(00) into space character(20) when I import a text file into DataBase.Thanks.
|
|
|
|
|
What do you mean by "hex character"? Do you mean a character where you express the character code in hexadecimal?
Hexadecimal numbers are written using the &H notaion. The value 32, or hexadecimal 20, are written as &H20.
To create a character value from a numerical value, you use the Chr function.
If you put those togheter, you get Chr(&H20) to produce a space character.
Do you have problems with the replacing part? How about the Replace function?
---
b { font-weight: normal; }
|
|
|
|
|
LOL - when I saw &H20, I thought it said H2O, and that you were kidding....
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Hi,Guffa
I had solved my problem,thanks.
|
|
|
|
|
'Values for variables on lines 25 - 29, 32, and 36
'must be set prior to running this script.
On Error Resume Next
Dim RegObj
Dim SysEnv
Set RegObj = WScript.CreateObject("WScript.Shell")
'***** Specify the DSN parameters *****
DataSourceName = "Name_of_Connection"
DatabaseName = "Name_of_DB"
Description = "Description of connection"
LastUser = "Default_Username"
Server = "Put_server_name_here"
'if you use SQL Server the driver name would be "SQL Server"
DriverName = "SQL Server"
'Set this to True if Windows Authentication is used
'else set to False or comment out
WindowsAuthentication = True
'point to DSN in registry
REG_KEY_PATH = "HKLM\SOFTWARE\ODBC\ODBC.INI\" & DataSourceName
' Open the DSN key and check for Server entry
lResult = RegObj.RegRead (REG_KEY_PATH & "\Server")
'if lResult is nothing, DSN does not exist; create it
if lResult = "" then
'get os version through WSCript Enviroment object
Set SysEnv = RegObj.Environment("SYSTEM")
OSVer = UCase(SysEnv("OS"))
'check which os is running so correct driver path can be set
Select Case OSVer
Case "WINDOWS_NT"
DrvrPath = "C:\WinNT\System32"
Case Else
DrvrPath = "C:\Windows\System"
End Select
'create entries in registry
RegObj.RegWrite REG_KEY_PATH & "\DataBase",DatabaseName,"REG_SZ"
RegObj.RegWrite REG_KEY_PATH & "\Description",Description,"REG_SZ"
RegObj.RegWrite REG_KEY_PATH & "\LastUser",LastUser,"REG_SZ"
RegObj.RegWrite REG_KEY_PATH & "\Server",Server,"REG_SZ"
RegObj.RegWrite REG_KEY_PATH & "\Driver",DrvrPath,"REG_SZ"
'if WindowsAuthentication set to True,
'a trusted connection entry is added to registry
'else, SQL Authentication is used.
if WindowsAuthentication = True then
RegObj.RegWrite REG_KEY_PATH & "\Trusted_Connection","Yes","REG_SZ"
end if
'point to data sources key
REG_KEY_PATH = "HKLM\SOFTWARE\ODBC\ODBC.INI\ODBC Data Sources\" &
DataSourceName
'and add the name of the new dsn and the driver to use with it
RegObj.RegWrite REG_KEY_PATH,DriverName,"REG_SZ"
MsgBox DataSourceName & " DSN Created!"
else
MsgBox DataSourceName & " DSN already exists!"
end if
Set RegObj = Nothing
Set SysEnv = Nothing
|
|
|
|
|
I write some text in my application, I want to export to Microsoft Word, please help me
................
|
|
|
|
|
www.voiceguide.com/vghelp/html/modVbs.htm"
u can also find good reference at Microsoft site
u need to add
1. Microsoft Office lib 10 or 11 or 9
and MicorSoft word 9.0 lib
right click on project
Add referece
and select the above mentined components
bye
|
|
|
|
|
I use RichTExtBox in my application and paste image in to it when i saved it I want it remember all, please help me?
Thanks
................
|
|
|
|
|
hi all,
i'm developin a web application in vb.net 2005 in which i need certain values to be passed to a word document....but i'm unable to do so....can anyone here help me...
Any help will be very kind of you
Thanks..
|
|
|
|
|
this is the function I am using by passing datatable and filename
Private Sub SaveDataToMSWord(ByVal dt As DataTable, ByVal FileName As String)
Try
Dim oldCI As System.Globalization.CultureInfo = _
System.Threading.Thread.CurrentThread.CurrentCulture
System.Threading.Thread.CurrentThread.CurrentCulture = _
New System.Globalization.CultureInfo("en-US")
Dim wapp As Word.Application
Dim wdoc As Word.Document
' Dim strDbFullPath As String
Dim strText As String
wapp = New Word.Application
wapp.Visible = True
wdoc = wapp.Documents.Add
Dim Count As Integer = 0
For Count = 0 To dt.Rows.Count - 1
Dim strDesignation As String = dt.Rows(Count).Item("ConJobTitleManual")
If strDesignation = "" Then
strDesignation = dt.Rows(Count).Item("Others")
End If
strText = dt.Rows(Count).Item("cpyName")
With (wapp.Selection)
.Font.Size = 14
.Font.Color = Word.WdColor.wdColorBlack
.Font.Bold = True
.TypeText(strText)
.InsertBreak(Type:=Word.WdBreakType.wdLineBreak)
.Font.Size = 9
.Font.Bold = False
.TypeText(dt.Rows(Count).Item("cpyAddress1") & "," & dt.Rows(Count).Item("cpyTown") & "," & dt.Rows(Count).Item("cpyCounty") & "," & dt.Rows(Count).Item("cpyPostCode"))
.InsertBreak(Type:=Word.WdBreakType.wdLineBreak)
.TypeText(dt.Rows(Count).Item("cpyCountry"))
.InsertBreak(Type:=Word.WdBreakType.wdLineBreak)
If dt.Rows(Count).Item("cpySIC1") <> 0 Then
.TypeText("SIC:" & dt.Rows(Count).Item("cpySIC1"))
If dt.Rows(Count).Item("cpySIC2") <> 0 Then
.TypeText("," & dt.Rows(Count).Item("cpySIC2"))
End If
End If
.InsertBreak(Type:=Word.WdBreakType.wdLineBreak)
.TypeText(dt.Rows(Count).Item("cpyURL"))
.InsertBreak(Type:=Word.WdBreakType.wdLineBreak)
.TypeText("Tel:" & dt.Rows(Count).Item("ConTelMain"))
.InsertBreak(Type:=Word.WdBreakType.wdLineBreak)
End With
Dim counter As Integer = Count
For counter = Count To dt.Rows.Count - 1
If dt.Rows(counter).Item("cpyName") = dt.Rows(Count).Item("cpyName") Then
strText = strDesignation & vbTab & dt.Rows(counter).Item("conEmail") & vbTab & vbTab & dt.Rows(counter).Item("cpyTelSwitchBoard")
With (wapp.Selection)
.Font.Size = 9
.Font.Bold = True
.Font.Color = Word.WdColor.wdColorBlack
.TypeText(dt.Rows(counter).Item("conFirstName") & " " & dt.Rows(counter).Item("ConSurName"))
.Font.Bold = False
.TypeText(" " & strText)
.InsertBreak(Type:=Word.WdBreakType.wdLineBreak)
End With
Else
Count = counter - 1
Exit For
End If
Next
Next
wapp.Selection.InsertBreak(Type:=Word.WdBreakType.wdPageBreak)
wdoc.SaveAs(FileName)
Dim idoc As Word._Document
idoc = wdoc
idoc.Close()
Dim iapp As Word._Application
iapp = wapp
iapp.Quit()
wapp = Nothing
GC.Collect()
Catch ex As Exception
msgbox(ex.Message)
End Try
End Sub
if it does not work then your asp_net user do not have rights to use the word. go to control panel and in user accounts change the asp net user from limited to adminsitrator. Hopefully this will reolve your problem.
Regards
Rizwan Bashir
|
|
|
|