|
HI,
I am getting the above msg when I try & close a MDI Child form in its form load method, as there is no data to display from SQL, so I catch the error, as below:-
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Sorry there has been an error" );
this.Close();
}
The message appears when it trys to close the form - has anyone any idea's.
The child form is opened from the MDI form as so:-
FrmUserList frmUserList = new FrmUserList(_isLiveConnection);
frmUserList.MdiParent = this;
frmUserList.Show();
Lady Programmers are a rare breed!
|
|
|
|
|
I have a collection of business objects bound to a DataGridView, and I would like changes made to my BO's through the grid to be persisted as they happen, or as close as possible to as they happen. I think a per row basis is fine, so which is the best event to handle in which to request that changes are persisted? At the moment I'm using RowValidated, so whenever a row is changed, it persists. Should I continue using this event?
|
|
|
|
|
|
Thanks Mike. I already implement IPropertyChanged, and my grid handles it nicely, but I want the grid to signal an object that a whole object, i.e. row, commit from the UI to the model, is mandated, much like editing records in Access. Until the user moves off a row, the grid should be able to restore the original values for that row.
|
|
|
|
|
Brady Kelly wrote: Until the user moves off a row, the grid should be able to restore the original values for that row.
Don't you need an Undo implementation for that. I mean your objects are bound right? So the original values are gone on a Cell by Cell basis right?
led mike
|
|
|
|
|
I'm looking in the LINQ to SQL DataContext neighbourhood for something that might help me there.
|
|
|
|
|
hi guys,
i am trying to upload a mp3 file from local disk to a remote server using FtpWebrequest. Everything went fine and the file is getting uploaded onto the remote server, but when i try to play that the file has no content in that, i got to a conclusion that it is not encoded properly during upload and here's where i request for someone's help as i dnt know how to encode a mp3 file while uploading
here is my code pls go thru and if you know where the prob is pls do suggest me.
Dim hostname As String = "ftp://ftp.domain.com/folder/"<br />
<br />
Dim fileName As String = path.Substring(path.LastIndexOf("\") + 1)<br />
Dim objMp3Info As New Monotic.Multimedia.MP3.MP3Info<br />
objMp3Info.Filename = path<br />
<br />
Dim username As String = "username"<br />
Dim password As String = "password"<br />
<br />
<br />
Dim request As FtpWebRequest = DirectCast(WebRequest.Create(hostname + "/" + fileName), FtpWebRequest)<br />
request.UseBinary = True<br />
request.Method = WebRequestMethods.Ftp.UploadFile<br />
<br />
request.Credentials = New NetworkCredential("username", "password")<br />
Dim sourceStream As New StreamReader(path)<br />
<br />
Dim fileContents As Byte() = Encoding.UTF8.GetBytes(sourceStream.ReadToEnd()) ----- this is where i need someones help<br />
sourceStream.Close()<br />
<br />
request.ContentLength = fileContents.Length<br />
<br />
Dim requestStream As Stream = request.GetRequestStream()<br />
requestStream.Write(fileContents, 0, fileContents.Length)<br />
<br />
requestStream.Close()<br />
<br />
Dim response As FtpWebResponse = DirectCast(request.GetResponse(), FtpWebResponse)<br />
MessageBox.Show("File Uploaded Sucessfully, status {0}", response.StatusDescription)
Thanks in advance...
Regards
Srinivas
|
|
|
|
|
Hello,
I am presently creating a list box control for our custom gui application using C# .
The dll is compiled using 1.1 compact framework SDK and is run on windows XP/CE embedded..
The new list box control has to be modified to use custom graphics.. the requirement right now is to replace the windows standard scroll box with the custom images provided..however since we are using compact SDK many of the properties related to the scroll box are not available. Does anyone have an idea a work around .
Regards
Vivian Neil Fernandes
|
|
|
|
|
How do I achieve the DropDown drop-down style in a combobox column in a DataGridView? I can't find any setting, but I would like to, e.g. on entering invoice lines, be able to either enter a product code or select one from a list.
|
|
|
|
|
Hi,
DataGridView gives us the ComboBox column type to attach a dropdown box in a column. Below is the code snippets for the same:
BEGIN CODE
DataGridViewComboBoxColumn colGender = new
DataGridViewComboBoxColumn();
// Size the column width so it is wide enough to display the
header
colGender.AutoSizeMode =
DataGridViewAutoSizeColumnMode.ColumnHeader;
colGender.DataPropertyName = "Gender";
// Specifiy the list of choices in the combo box
colGender.Items.AddRange(new string[] { "M", "F" });
// Sort the combo box contents alphabetically
colGender.Sorted = true;
// Disable sorting for the column
colGender.SortMode = DataGridViewColumnSortMode.NotSortable;
colGender.HeaderText = "Gender";
colGender.Name = "Gender";
colGender.ReadOnly = false;
dataGridView2.Columns.Add(colGender);
//
// Column: Marital status, combo box
//
// For this column, combo box contents are retrieved from the
database
DataGridViewComboBoxColumn colMaritalStatus = new
DataGridViewComboBoxColumn();
// Size the column width so it is wide enough to display the
header
colMaritalStatus.AutoSizeMode =
DataGridViewAutoSizeColumnMode.ColumnHeader;
colMaritalStatus.DataPropertyName = "MaritalStatus";
// Retrieve the list of choices from the database
colMaritalStatus.DataSource =
dataSetAdventureWorks.Tables["MaritalStatusChoices"];
// Identify the column in the Employee table that is used to
select the combo box item
colMaritalStatus.ValueMember = "MaritalStatus";
// If the column value is not human friendly, e.g., a foreign
key identity off to a related table,
// the DisplayMember property is used to identify the column
used for display purposes
colMaritalStatus.DisplayMember = "MaritalStatus";
colMaritalStatus.HeaderText = "Marital Status";
colMaritalStatus.Name = "MaritalStatus";
colMaritalStatus.ReadOnly = false;
dataGridView2.Columns.Add(colMaritalStatus);
END CODE
Hope this helps
Regards,
John Adams
ComponentOne LLC
|
|
|
|
|
Hi, all of you exeperts here..
I have one simple question, how to i open a windows form one project in other windows application project ??
I have 2 projects in one solution, and i added a refrence to my main windows application project, so i can see all the forms in other project.
Dim NewForm as windowsapp1.form1
NewForm = new windowsapp1.form1
NewForm.Show
Is there anyway to bypass this code, and open a form directly without declaring a new form and then open it.
Tnx in advance for your posts.
|
|
|
|
|
Please don't cross post. This is probably where this question belonged, but truth is, not many people post here. Either way, choose one forum for your post.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
I did find a way to do it using system.reflection.
Private Sub OpenFormFromAssembly(ByVal FormName As String)
Dim MyAssembly As Reflection.Assembly = Reflection.Assembly.LoadFile(" Assembly to load ")
Dim MyTypes As Type() = MyAssembly.GetTypes
For Each mType As Type In MyTypes
If mType.BaseType Is GetType(Form) Then
If mType.Name = formName Then
Dim o As Object = Activator.CreateInstance(mType)
Dim f As Form = CType(o, Form)
f.Show()
End If
End If
Next
End Sub
No need to declare a new form evry time you need to open it.
Tnx for your help.
|
|
|
|
|
Hi...,
I want to write a zoom function for a PictureBox. Therefore I have to change some values (Left, Top, Width, and Height) of the PictureBox. The PictureBox is redrawn, when I just change one of theses values. So, when I change all 4 values the PictureBox gets flickering and jumping around.
How to stop/activate the Redrawing of a PictureBox.
This is my code:
private void CalcPictureBox1()
{
int zoomedWidth = (int)(bitmapDepthBuffer.Width * pBoxZoomFactor);
int zoomedHeight = (int)(bitmapDepthBuffer.Height * pBoxZoomFactor);
if (zoomedWidth > panelDepthBuffer.Width)
{
this.pBoxDepthBuffer.Left = 0;
}
else
{
this.pBoxDepthBuffer.Left = (panelDepthBuffer.Width - zoomedWidth) / 2;
}
if (zoomedHeight > panelDepthBuffer.Height)
{
this.pBoxDepthBuffer.Top = 0;
}
else
{
this.pBoxDepthBuffer.Top = (panelDepthBuffer.Height - zoomedHeight) / 2;
}
this.pBoxDepthBuffer.Width = zoomedWidth;
this.pBoxDepthBuffer.Height = zoomedHeight;
}
Thank you in advance,
Michael
modified on Friday, June 20, 2008 4:33 PM
|
|
|
|
|
To update position and size at the same time, you can use...
.SetBounds(left, top, width, height); [also: .Scale may be of use]
Hope this helps.
Matthew Butler
|
|
|
|
|
Hi Matthew,
thank you for the tip, but it didn't help, whyever. The PictureBox on the panel is still jumping around, when I change it with:
this.SetStyle(ControlStyles.DoubleBuffer | ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint | ControlStyles.ResizeRedraw, true);
...
pBoxDepthBuffer.SizeMode = PictureBoxSizeMode.Zoom;
panelDepthBuffer.Controls.Add(pBoxDepthBuffer);
panelDepthBuffer.AutoScroll = true;
...
this.pBoxDepthBuffer.SetBounds(newLeft, newTop, zoomedWidth, zoomedHeight);
I've also changed the Style of the Form with this.SetStyle to DoubleBuffering. Nothing helped.
Do you have any further ideas?
Thanks,
Michael
|
|
|
|
|
Hi...,
I have tried this rude method by setting the image first to null, changing the Bounds and initialalizing the image again:
this.pBoxDepthBuffer.Image = null;
this.pBoxDepthBuffer.SetBounds(newLeft, newTop, zoomedWidth, zoomedHeight);
this.pBoxDepthBuffer.Image = bitmapDepthBuffer;
This works now for me.
Thank you,
Michael
|
|
|
|
|
I would never bother with a picture box, I'd just draw the bitmap myself.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
So, in order to allow in place editing of object properties through a Combobox, I need to implement my own Combobox. What would be the best way to do this? I'm thinking of using a TextBox and a ListBox, and letting the ListBox do most of the work. Any suggestions on other ways?
|
|
|
|
|
Why not to use a PropertyGrid?
Best regards,
Jaime.
|
|
|
|
|
Or...you could inherit from a combobox and then edit the events and properties. Then to further assist you can override the WndProc function with WinAPI commands.
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my homepage Oracle Studios
Discounted or Free Software for Students:
DreamSpark - downloads.channel8.msdn.com
MSDN Academic Alliance - www.msdnaa.com
|
|
|
|
|
Programatically converting docx to PDF without office 2007 being installed.
|
|
|
|
|
3rd party control?
Bob
Ashfield Consultants Ltd
|
|
|
|
|
.net windows application under .net framework 3.0 or 3.5. Input is .docx file and should convert to .pdf file.
Microsoft has given SaveAsPDFandXPS.exe' word addin, this is giving SaveAs option as .pdf file.
By making use of this exe the below code is converting to PDF,
// Specifying the format in which you want the output file
object format = Word.WdSaveFormat.wdFormatPDF;
//Changing the format of the document and save them into Destination Directory
newApp.ActiveDocument.SaveAs2000(ref Target, ref format,
ref Unknown, ref Unknown, ref Unknown,
ref Unknown, ref Unknown, ref Unknown,
ref Unknown, ref Unknown, ref Unknown);
// for closing the application
newApp.Quit(ref Unknown, ref Unknown, ref Unknown);
This is done by referenceing the Microsoft.Office.Interop.Word.dll. Without any reference of office dll's, is it possible to convert to PDF?
Thanks and Regards,
|
|
|
|
|
dhananjayamurthy wrote: This is done by referenceing the Microsoft.Office.Interop.Word.dll. Without any reference of office dll's, is it possible to convert to PDF?
Not of you need to reference the Microsoft.Office.Interop.Word.dll. As I said, if you don't want to install word then it will probably have to be a 3rd party control.
Bob
Ashfield Consultants Ltd
|
|
|
|
|