|
Hello
Is there anyone who can tell me how to use the mtgccombobox in datagridview in vb.net 2005 to replace the combobox that comes with the datagridview
soren lovgren
|
|
|
|
|
Here is my problem :
On a PC there is a software that I do not control that is writing a line text in a file every time it receive data.
My software, in VB .net, should read this file and recover only the last line. I made a routine that read the file every 5 secondes.
It's running under WinDows XP.
The problem is that the soft that is writing into the file do not give me access to the file, even in read only. I use a streamreader .
The solution I currently use consist in making a copy of the original data file, then read the copy. This is ugly !!
Any idea to do it the proper way ?
Thanks for help,
Loïc
|
|
|
|
|
Can't be done. If it's open for writing, you can't read it.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I am working on this application at the moment that automatically sends and email to a user and prompts them to input data to store in an sql server database. To try and simplify to process of inputting data I was wondering if it is possible to insert the .aspx page into the email so the user dosen't need to click on a link and then input the data. Any help is much appreciated.
|
|
|
|
|
No, it's not. You can send the HTML that is generated when the server interprets the aspx page, but not the page itself.
Really, you're MUCH better off just sending a link. In this age of email scams and spam, email filters will pretty much wreck your page to begin with, or the user might not get it at all.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi
When the user select some files and copies them in using rightclick->Copy, or Ctrl+C how could an application get those files?
To make myself more clear, I want to retreive the files that user have selected and copied.
(I have tried the Clipboard object in vb6 but I couldn't get these information out of it.)
Thanks
|
|
|
|
|
Hi,
I am using VB6 and I want to know how could I shutdown the computer from my program while not run as an administrator.
I used the file "shutdown.exe" in windows XP to shutdown while run as an administrator. how if there are no administrator privillages?
Thanks
|
|
|
|
|
|
Hi an thanks for the answer.
When I used the InitiateSystemShutdown API, (even though I was running under an administrator account, Nothing in fact happened.
I tries to give my computer neame, but that didn't help either.
Could you please explain why?
I am using windows XP 2001 without any service packs.
Thanks
|
|
|
|
|
Could you please explain why?
Could be dozens of things. We can't tell you anything without seeing your code.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
|
Hi all,
Does someone here know how can I execute an external vbscript file from within an ASP.NET page (using VB.NET).
Thanks,
Yaron
|
|
|
|
|
|
Thanks. But that's not what I meant.
I need to be able to execute (run) a vbs file from an ASP.NET page not to include the script in an ASP page or another vbscript.
Anyway thanks for your prompt response.
|
|
|
|
|
|
Hi, i need to prevent users from pasting into the combo box.
how do i do this?
mo.
|
|
|
|
|
I dont know the best way but the tricky part is
1. put a context menu on your form and dont add any thing in it.
2. assign this context menu to combo box in combobox properties name context menu
3. in key press event of combobox write
e.handled =true
for 100% read only you can make dropdown style of combobox to dropdownList
|
|
|
|
|
I found an easy way to do this is to make the combobox ownerdrawn, and make the combobox a dropdownlist. I personally made a usercontrol with a combobox on it, and handled the 'DrawItem' event of the combobox with:
<br />
Private Sub ComboBox1_DrawItem(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DrawItemEventArgs) Handles Main.DrawItem<br />
Dim cmb As ComboBox = CType(sender, ComboBox)<br />
If e.Index = -1 Then<br />
Return<br />
End If<br />
If sender Is Nothing Then<br />
Return<br />
End If<br />
Dim Color1 As Color = Color.Black<br />
Dim g As Graphics = e.Graphics<br />
'string brushName = (string)cmb.Items[die.Index];<br />
'SolidBrush selectedBrush = (SolidBrush)brushMap[brushName];<br />
Dim selectedbrush As New SolidBrush(Color1)<br />
selectedbrush.Color = Color1<br />
' If the item is selected, this draws the correct background color<br />
e.DrawBackground()<br />
e.DrawFocusRectangle()<br />
Dim rectPreviewBox As Rectangle = e.Bounds<br />
<br />
Dim item As String = CType(cmb.Items.Item(e.Index), String)<br />
' Draw the name of the color selected<br />
Dim font As New Font("Times New Roman", 12, FontStyle.Regular, GraphicsUnit.Pixel)<br />
g.DrawString(item, font, New SolidBrush(e.ForeColor), e.Bounds.X, e.Bounds.Y + 1)<br />
End Sub<br />
<br />
|
|
|
|
|
Hi everyone - im trying to develop a solution whereby an existing excel spreadsheet gets submitted to an online SQL server database.
The excel sheet is flat one dimensional and without formula.
I have currently got all the information from the sheet into an array...my question is how to get the information into sql server from VBA. Can I use something like the following..
Dim DB As DAO.Database
Set DB = DBEngine.OpenDatabase("server=localhost;database=blah")
or do i need to implement webservices...next question is can a webservice handle an array as a parameter or do i need to rethink my logic at the spreadsheet level.
I have pulled code snippets from google, and there seems to have been so many different providers database engines / references needed that im completely confused. What should i be using with Excel 2002 - what is the most stable db engine.
|
|
|
|
|
'you may need to add refrences for this to work look ADO library
'DataBase Connection parameters
Public stConn As String 'Connection String
Public Cnt As New ADODB.Connection 'Connection Object
public StConn as String
stConn = "Provider=sqloledb;" & _
"Data Source=ServerName;" & _
"Initial Catalog=Database;" & _
"User Id=sa;" & _
"Password=yourpassword;"
Cnt.OPEN strconn
Qry_str = "your Query Insert,Update,Delete;"
Cnt.Execute Qry_str
Mandar Patankar
Microsoft Certified professional
|
|
|
|
|
Thanks for the reply Mandar
Dim strConnection, Password, User, InitialC, Source
Source = "PAULANT" 'Your server name
User = "sa" 'The SQL user you want to use (probably 'sa')
Password = "blah" 'The password for the previously defined User
InitialC = "blah" 'The database you wish to maintain
strConnection = "Provider=SQLOLEDB;Persist Security Info=False;Password=" & Password & ";User ID=" & User & ";Initial Catalog=" & InitialC & ";Data Source=" & Source
Set objCommand = New ADODB.Command
objCommand.ActiveConnection = strConnection
''' Load the SQL string into the Command object.
objCommand.CommandText = "INSERT INTO tbl_register (fld_name) Values ('test')"
''' Execute the SQL statement.
objCommand.Execute
- This works - but using an IP Address doesn't work....I want to perform this command with a remote SQL Server
|
|
|
|
|
Add another parameter in your connect string: "SERVER=999.999.999.999;"
Like so -
Dim strConnection, Password, User, InitialC, Source, Server
Server = "999.999.999.999" 'Set your own IP here
Source = "PAULANT" 'Your server name
User = "sa" 'The SQL user you want to use (probably 'sa')
Password = "blah" 'The password for the previously defined User
InitialC = "blah" 'The database you wish to maintain
strConnection = "Provider=SQLOLEDB;Server=" & Server & ";Persist Security Info=False;Password=" & Password & ";User ID=" & User & ";Initial Catalog=" & InitialC & ";Data Source=" & Source
Goodluck!
Cprompt
|
|
|
|
|
I´ve got a report to show in VB.NET which i created using the embedded crystal reports designer that comes with visual studio. In that report i´ve got two tables in a dataset linked by a common field. The report has about 1000 rows and it takes too much time too load. And in top of all, cpu usage goes up to 99%... I read in google that in the crystal reports software (the full version) there is an option called "save data with report", that if it´s disabled can speed up the report load, but i can´t find it anywhere in visual studio.
Sorry about my english, and thanks for reading, i really need an answer!
|
|
|
|
|
On a form i created a structure and i generated a variable ,set its properties, then added to combobox items, But when i run the form , combobox have items like "BackApp.Form1+ComboItemX" what s problem?
Public Structure ComboItemX<br />
Public ID As Integer<br />
Public Value As String<br />
End Structure<br />
<br />
Protected Sub ReadTemplates()<br />
Dim itemX As ComboItemX<br />
cmbTemplates.Items.Clear()<br />
cmbTemplates.DisplayMember = "Value"<br />
cmbTemplates.ValueMember = "ID"<br />
itemX.ID = 0<br />
itemX.Value = "NEW TEMPLATE"<br />
cmbTemplates.Items.Add(itemX)<br />
Try<br />
cn.Open()<br />
cmd.CommandText = "SELECT * FROM TEMPLATES "<br />
dr = cmd.ExecuteReader<br />
Do While dr.Read<br />
Dim item As ComboItemX<br />
item.ID = dr.Item("TEMP_ID")<br />
item.Value = dr.Item("TEMP_NAME")<br />
cmbTemplates.Items.Add(item)<br />
Loop<br />
Catch ex As Exception<br />
ShowErrorMessage(ex)<br />
Finally<br />
dr.Close()<br />
cn.Close()<br />
End Try<br />
End Sub
|
|
|
|
|
Hi there,
I have a code which check for the url and return me the output in excel file the problem is i got a identifier in my data base which is '000002435' but while transfer into excel i get only '435' any suggestion here is the code snippet
With Excel
.SheetsInNewWorkbook = 1
.Workbooks.Add()
.Worksheets(1).Select()
For intColumn = 0 To ds.Tables(0).Columns.Count - 1
.Cells(1, intColumn + 1).Value = ds.Tables(0).Columns(intColumn).ColumnName.ToString
Next
'For displaying the column value row-by-row in the the excel file.
Dim o As Object
For intRow = 0 To ds.Tables(0).Rows.Count - 1
For intColumnValue = 0 To ds.Tables(0).Columns.Count - 1
.Cells(intRow + 2, intColumnValue + 1).Value = ds.Tables(0).Rows(intRow).ItemArray(intColumnValue).ToString
Next
Next
.ActiveWorkbook().SaveAs("C:\excel\excelsheet_output.xls")
.ActiveWorkbook.Close()
End With
regards
cyus
|
|
|
|