|
There's a sample right here on CodeProject:
Outlook Drag and Drop in C#[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Thanks for the answer!
But System.Runtime.InteropServices; is used.
This causes error messages on the Exchange Server.
|
|
|
|
|
Office Interop is blocked on a server. So, why would you want to create a UI for the server? And might what you want not be easier by writing an outlook-plugin?
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
I'll suggest it to my investigator. Thank you for all your answers!
|
|
|
|
|
Hello everyone,
I created a code to save all information in datagriedview1 when I close my application but it doesn't work. Could you help me to find my error?
Imports System.IO
Imports System.Runtime.Serialization.Formatters.Binary
Public Class Form1
<Serializable()> _
Public Class TNode
Public text As DataGridView
End Class
Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
DataGridView1.Rows.Add(TextBox1.Text, TextBox2.Text)
End Sub
Private Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim DataGridView1 As DataView
Dim Col As Integer
Dim ran As Integer
Dim contacttable As New List(Of String)
Dim f As IO.FileStream = File.Create("enregistreContact.bin")
Dim text As New BinaryFormatter
Try
For Ran = 0 To DataGridView1.Count - 1
For Col = 0 To 2
text = DataGridView1.Item(Col, Ran).Value
Next
Next
text.Serialize(f, contacttable)
Catch File As Exception
MsgBox("You must write a text!")
End Try
f.Close()
End Sub
End Class
|
|
|
|
|
You should be storing all of your data in a suitable data stricture, NOT directly in the DGV. Once you have the data in a data structure, you set the DataSource of the DGV to the data structure. It also makes it MUCH easier to save the data structure to a file than the DGV.
You data structure can be a List<t>, a DataSet, a DataTable, some custom collection, ... whatever. Just don't use the DGV to "store" data. Controls are there to show a visual representation of data and edit that data, not to store it.
|
|
|
|
|
Thank for your answer.
Have Nice day.
|
|
|
|
|
|
Thank you for your answer.I'm going to try.I'm continous to search a good code.
Have good day.
|
|
|
|
|
Here is a sample of the Issue:
Class A
Implements ICloneable
Public _ar(2) As Byte
Public Function Clone() As Object Implements System.ICloneable.Clone
Return Me.MemberwiseClone()
End Function
End Class
Private Sub ToolStripButtonTest1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButtonTest1.Click
Dim _A As New A
Dim _B As A
_A._ar(0) = 1
_A._ar(1) = 2
' I thought this would create a new instance copy of _A.
_B = _A.Clone()
' However, these changes are reflected in _B.
_A._ar(0) = 2
_A._ar(1) = 1
end sub
What am I missing? How do I create a copy of _A?
Thanks
|
|
|
|
|
speedbump99 wrote: What am I missing? It's not a class, but an array of byte-values.
How to copy the contents of your array of values to another array? Array.Copy Method (System)[^].
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
Thanks a lot, I get it now.
|
|
|
|
|
You're welcome; and I recognize the confusion/frustration
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
Creates a shallow copy of the current Object. You're creating a new instance of your class, but sharing the same byte array reference. Changes to the array on one instance will update the array on the other instance.
Shallow Copy vs. Deep Copy in .NET[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Hi:
I work on a program that must capture the printout of a DOS application, filter its contents and send them to another printer.
Monitoring the print queue, I can detect the print job, but I need to take the name of the .spl file that contains the data to print or some way to take its content.
I use the PrintSystemJobInfo object but:
The JobStream property has a NULL value
Neither the JobName property nor the Name property point to the name of the file that contains the data.
(I have read the code of the PrinterQueueWatch project published in the articles, but it is too complex)
This is my first post in the forum.
I appreciate the help
modified 7-May-18 18:55pm.
|
|
|
|
|
Hay Guys,
I'm working on a subtitle editing program... I was wondering if there are other sdk's to play media files rather than the wmp.dll s. The wmp.dll doesn't support text overlaying in front of the video. Is there any other media player sdk to overlay text in front of the video playback?
|
|
|
|
|
Have you tried Fun with Video[^]?
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
Thank You I'll try it! But usually the video is rendered by the gpu in front of the window right? So if a window is kept in front of this gpu overlay will it be visible? The gpu always overlay it in front of everything right?
|
|
|
|
|
Asanka Akash Sovis wrote: So if a window is kept in front of this gpu overlay will it be visible? The GPU doesn't know about Windows and does not determine the paint-order. You do.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
Hello,
I found this vb transcripten of the codeproject article mentioned below.
However sometimes I would like to see the whole picture in the ImageViewer.
For this I would have to set the autoscroll to false and the sizemode property of
the embedded imagebox to "stretch".
Do I have to create another property in ImageViewer to change the sizemode to
Normal, StretchImage, AutoSize, CenterImage, Zoom
I am afraid this is beyond my level. Could someone help?
Thank you.
Michael
Public Class ImageViewer
Inherits Panel
'based on http://www.codeproject.com/KB/linq/ScrollablePicturebox.aspx
Dim innerPicture As New PictureBox()
Dim mPictureFile As String = String.Empty
Dim mAutoScroll As Boolean = True
Sub New()
' add the inner picture
innerPicture.Top = 0
innerPicture.Left = 0
innerPicture.SizeMode = PictureBoxSizeMode.Normal
Controls.Add(innerPicture)
End Sub
Public Property PictureFile() As String
Get
Return mPictureFile
End Get
Set(value As String)
mPictureFile = value
If (String.IsNullOrEmpty(mPictureFile) = False) Then
' set the image to the image file
innerPicture.Image = Image.FromFile(mPictureFile)
' resize the image to match the image file
innerPicture.Size = innerPicture.Image.Size
Else
innerPicture.Image = Nothing
End If
End Set
End Property
Public Overrides Property AutoScroll As Boolean
Get
Return mAutoScroll
End Get
Set(value As Boolean)
mAutoScroll = value
End Set
End Property
End Class
|
|
|
|
|
Dear All,
I'm trying to figure out the way to overwrite the existing content of the text file after found the specific word. The example content of text file as below. I'm looking the example in VB.Net to overwrite the words after the "No = " and "ID = ".
Name = MyName
No = 12345678
ID = 2000S1-DD7-8TA
Home = SD-PS-D1
Thanks.
|
|
|
|
|
You load the text file into memory, like an array of strings. Make your replacements with String.Replace(), or whatever is appropriate for your situation, then write the entire file back out to disk.
|
|
|
|
|
As Dave described, load the file into an array of lines.
Replace won't work in this case, you need to chop up the line into
Text before the characters to be replaced
text to be replaced
text after the characters to be replaced
Repeat for the ID =
Then you need to concatenate the bits together with the replacement text. This is not difficult just fiddly and will take some time to get right.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hi RAH,
Thanks for the guidance, however, I still unable make the code work as below. Appreciate if you could show the example.
MyProfile_File = "C\MyProfile\MyProfile.txt"
Dim MyProfile_StreamReader As New StreamReader(MyProfile_File)
Dim MyProfile_Content As String
MyProfile_Content = MyProfile_StreamReader.ReadToEnd
MyProfile_StreamReader.Close()
Dim MyProfile_StreamWriter As New StreamWriter(MyProfile_File, True)
Dim a As String()
a = Split(MyProfile_Content, vbCrLf)
Dim sFix As String
For i As Integer = 0 To a.Length - 1
sFix = a(i)
If a(i).IndexOf("ID = ") >= 0 Then
sFix = sFix.Replace(a(i).IndexOf("ID = ") + 1, "1122334")
End If
MyProfile_StreamWriter.WriteLine(sFix)
Next
MyProfile_StreamWriter.Close()
Thanks.
Best Regards,
EK Tan
|
|
|
|
|
It has been too many years since I coded in VB so no example!
You are doing what I said would NOT work - Replace is not going to work in this case because you do not know what to replace. You cannot work character by character you need to work with a string.
Get the POSITION after ID = and put the string to the left into another string - your start string
Locate the next space after the POSITION + 2 - this is the start of the end string get everything to the right of that position, it is your end string
Concatenate the start string + your replacement text + the end string
add this to a new array of lines to be written out.
Never underestimate the power of human stupidity
RAH
|
|
|
|