|
|
Hi
i found in your code , this code snippet
//Get the values stored in the text boxes
txtDivision = gvTaskNewRow[0].ToString();
txtSegment = gvTaskNewRow[1].ToString();
txtDetail = gvTaskNewRow[2].ToString();
txtFuntion = gvTaskNewRow[3].ToString();
txtDescription = gvTaskNewRow[4].ToString();
txtTask = gvTaskNewRow[5].ToString();
txtCounty = gvTaskNewRow[6].ToString();
txtHighway = gvTaskNewRow[7].ToString();
please check is it correct?
i think that should be like this
//Get the values stored in the text boxes
txtDivision.Text = gvTaskNewRow[0].ToString();
---
thanks
|
|
|
|
|
No, his code is correct. You don't need to set the .Text property on a string. He prefixed the variables like it was a text box, but they were actually strings.
I'm going to become rich when I create a device that allows me to punch people in the face over the internet.
"If an Indian asked a programming question in the forest, would it still be urgent?" - John Simmons / outlaw programmer
|
|
|
|
|
Hey guys
im trying to hide an image object (blob field) on a crystal report at runtime. the user will check a checkbox to either display or hide the object.
ive been battling with this for days...
i added a formula to the report in the designer as "False" so if i dont change this property at runtime is shouldnt show at runtime? correct? i assign the formula to the blob object.
what ive done in the code is i get the formulas collection object from the report then instantiate a formula field from this collection. i then assign formulaField.Text = checkbox.checked.ToString()
but the doesnt work
any suggestions?
Harvey Saayman - South Africa
Junior Developer
.Net, C#, SQL
think BIG and kick ASS
you.suck = (you.passion != Programming)
|
|
|
|
|
Hi
Does anyone know how to prevent a user from moving a ToolStrip from one ToolStripContainer into another? The scenario is that I have two non-TopLevel forms on a form, both have a ToolStripContainer and each ToolStripContainer has one ToolStrip. I am able, by default, to drag the ToolStrip from one ToolStripContainer into the other ToolStripContainer.
I'm pretty surprised that this is default behaviour and that there doesn't appear to be a simple 'AllowToolStripToChangeContainers' boolean to stop this happening.
The only 'solution' to this I could find on the net (after almost a day of trawling) was to trap the ControlAdded event on the ToolStripPanel and if the ToolStrip being added doesn't belong (originally) to that ToolStripPanel, then remove it and add it back to its original ToolStripPanel.
This 'works' in so much as it works, but there is a very annoying flicker and mouse judder when the ToolStrip is immediately removed then added.
I'd really appreciate any help
Thanks
Rob
|
|
|
|
|
Hi! I would like to export my drawing created in picture box using GDI+ into bitmap format. But it seem I am only getting a white blank screen. Can anyone help me to solve it? Thanks a lot.
using System;
using System.IO;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Collections.Generic;
using System.Windows.Data;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Navigation;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Windows.Documents;
using System.Windows.Markup;
using StudentToolkit;
namespace test_drag
{
public partial class Window1
{
private Graphics g;
private System.Drawing.Pen pen1;
Bitmap bitmap;
Font font;
List<Concept> objList = new List<Concept>();
float x;
float y;
bool down = false;
int selectedIndex = -1;
public Window1()
{
this.InitializeComponent();
bitmap = new Bitmap(pictureBox.Width,pictureBox.Height);
g = Graphics.FromImage(bitmap);
Concept obj1 = new Concept("Rect", "Rect1", System.Drawing.Color.Black, 20, 20, 5, 5);
objList.Add(obj1);
Concept obj2 = new Concept("Oval", "Oval1", System.Drawing.Color.Blue, 20, 20, 40, 30);
objList.Add(obj2);
Concept obj3 = new Concept("Oval", "Oval1", System.Drawing.Color.Red, 20, 20, 80, 30);
objList.Add(obj3);
Concept obj4 = new Concept("Line", "line1", System.Drawing.Color.Aqua, 4, 80, 4, 50);
objList.Add(obj4);
font = new Font("Arial", 10);
// Insert code required on object creation below this point.
}
private void pictureBox_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
{
if (objList != null)
{
foreach (Concept obj in objList)
{
pen1 = new System.Drawing.Pen(obj.Brush_color, 1);
if (obj.Con_shape == "Rect")
e.Graphics.DrawRectangle(pen1, obj.XPos, obj.YPos, obj.Width, obj.Height);
else if (obj.Con_shape == "Oval")
e.Graphics.DrawEllipse(pen1, obj.XPos, obj.YPos, obj.Width, obj.Height);
else if (obj.Con_shape == "Line")
e.Graphics.DrawLine(pen1,obj.Height, obj.Width, obj.XPos, obj.YPos);
pen1.Dispose();
}
}
}
private void export_Click(object sender, RoutedEventArgs e)
{
int width = bitmap.Width;
int height = bitmap.Height;
int i, j;
for (i = 0; i < width; i++)
{
for (j = 0; j < height; j++)
{
System.Drawing.Color pixelColor = bitmap.GetPixel(i, j);
System.Drawing.Color newcolor = System.Drawing.Color.White;
bitmap.SetPixel(i, j, newcolor);
}
}
//
bitmap.Save(@"C:\concept1.jpg", System.Drawing.Imaging.ImageFormat.Jpeg);
MessageBox.Show("The created concept map has been exported to your local drive");
}
}
}
|
|
|
|
|
yuenli wrote: But it seem I am only getting a white blank screen
yuenli wrote: System.Drawing.Color newcolor = System.Drawing.Color.White;
bitmap.SetPixel(i, j, newcolor);
led mike
|
|
|
|
|
|
Copy over your current code export_Click method with this...
private void export_Click(object sender, RoutedEventArgs e) {
bitmap.Save(@"C:\concept1.jpg", System.Drawing.Imaging.ImageFormat.Jpeg);
MessageBox.Show("The created concept map has been exported to your local drive");
} Glad I could help,
Sounds like somebody's got a case of the Mondays
-Jeff
|
|
|
|
|
Hi! Thanks a lot for the suggestion but I still cannot get the whole drawing of my shapes. Once the system being run, it will draws 3 shapes on the picture box, then when click on the export button it will produce an jpeg file with 3 shapes on it and a white background. Does anyone know how to do that? Thanks.
|
|
|
|
|
If your picture is in an Image control you can simply use the Image property and save the picture to a bitmap format.
Bitmap myimage = new Bitmap(pictureBox1.Image);
string savepath = @"C:\";
imgFormat = ImageFormat.Jpeg
myimage.Save(savepath, imgFormat);
Just because we can; does not mean we should.
|
|
|
|
|
I have a database that has one table (let's call it Cyl) that has several fields "linked" to other reference tables. The associated database editing application allows the user to enter new records for through a combination of textboxes and comboboxes. The comboboxes have as their datasource the linked tables. So, the user can select an item for the new record from a pre-set list of items stored in one of the other tables. The "linked" comboboxes are databound to the source datatable (Cyl) on the SelectedValue property and their datasource and value member are the linked tables values.
This works well unless the user needs to input data for a field in the Cyl table that is not currently present in one of the linked tables (let's say a Cust table). In that case, I can get the software to save the Cust field data even if the entry for the Cust field is not in the related Cust table, but the data does not display correctly on the form because the Cust field in the Cyl table is bound to the SelectedValue of the Cust combobox and if the entry for the Cust field is not represented in the Cust table, there is no value in Cust combobox.
So, basically what I need is to have the a field from one table, say the Cust table, loaded into a combobox that users will use to enter data for a field in another table while still allowing the user to enter data that is not in the Cust table.
I hope this question makes sense.
Thanks.
|
|
|
|
|
I've been tearing my hair out (and I can ill afford that!)
for hours trying to associate an icon in the toolbox for
a user control that I created. Whatever I do, the icon is
always the stock icon (the gear).
I created a 16x16 bitmap, and made it an embedded resource
in my control. I gave the control class an attribute as follows:
[ToolboxBitmap(typeof(CommentBox), "CommentBox.bmp")]
public class CommentBox : UserControl
I have a test form class, that when I bring it up in design mode,
I would like the control to show up in the toolbox (with its
correct icon). I have tried the "Choose item..." context menu item in the
toolbox to remove the control dll, and then reinsert it...to no avail.
Any suggestions what I'm missing?
Thanks,
Tom
|
|
|
|
|
what version of Visual Studio are you using? It's possible that you have to create a custom control to associate a custom icon with it.
led mike
|
|
|
|
|
VS 2008, Mike.
Actually, I just want an icon for the tool box.
|
|
|
|
|
hain wrote: Actually, I just want an icon for the tool box.
That's what I'm talking about. I seem to remember in VS2005 (which I am still using) that you can't associate a custom Icon to a User Control. You may need to do a Custom Control if you want that feature.
led mike
|
|
|
|
|
Other than having a
protected override void OnPaint(PaintEventArgs pe)
method, what makes a custom control "custom"?
I tried inheriting my control from System.Forms.Control,
rather than UserControl.
Still no luck.
modified on Thursday, March 13, 2008 12:54 PM
|
|
|
|
|
hain wrote: what makes a custom control "custom"?
It's not that it's "custom" it's that it is not a UserControl. It implements one of more interfaces that provide various integration capacity with Visual Studio.
http://msdn2.microsoft.com/en-us/library/ms180794(VS.80).aspx[^]
here is what I have in VS2005 that works for an extenderProvider
[ProvideProperty("ShowMRUList", typeof(ToolStripMenuItem)),
ToolboxItem(true), ToolboxBitmap( typeof(ToolStrip))]
public partial class MRUMenuItem : Component, IExtenderProvider, IDisposable, ISupportInitialize
led mike
|
|
|
|
|
Say you have a structure like this:
Root
\__ Bin
\__ Controls
\__ Commentbox.cs
\__ CommentBox.bmp
You could use the attribute as is above.
If however it exists in a another folder, you would have to refer to a type in that folder that has the same namespace of the folder.
Example if the BMP was in the Resources folder:
[ToolboxBitmap(typeof(Resources.ResourceManager), "CommentBox.bmp")]
|
|
|
|
|
|
|
Hi,
I am trying to access a webservice over the internet and getting the following exception.
'A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond ' .
I am trying to access the web service with the help of following code and getting the above exception.
protected void Page_Load(object sender, EventArgs e)
{
GlobalWeather gw = new GlobalWeather();
string cities =gw.GetCitiesByCountry("India");
}
Please help.
|
|
|
|
|
I think you will get help better if you posted this question to the ASP.NET forum
M. Gouda
foreach(Minute m in MyLife)
{
myExperience++;
}
|
|
|
|
|
You are getting a general communication error, so it could be any number of things. Go through the basic diagnostics first: can you ping the web service server from where your code is running? Try also to load the web service URL in your browser, if it's http based.
|
|
|
|
|
Are you certain that the web service is running? Do you have the proper URL and permissions to access the WS? Try updating your web reference... does it work? If not, you either have an incorrect URL or the WS is down. If it does, then make sure the new Web Reference exports such a call. Let me know if you figure it out (or if both the WS responds to the update AND that method is exported).
Sounds like somebody's got a case of the Mondays
-Jeff
|
|
|
|
|