|
Of course it does. Now donate a pint of blood to the Red Cross.
|
|
|
|
|
I recommend if you're coding blind and trying things to see if they work, you buy a C# book and work through it.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Latheesan wrote: I have an array of tabpages and shtbs because, i want to be able to many many instances of tabs with richtextboxes inside them, dynamically on demand.
You don't need arrays for that, the TabControl and TabPage have Collections for them.
|
|
|
|
|
Oh? i didnt know that,
Is there any example on how to use this? I haven't seen any good tutorials on tab pages anywhere yet. I did do a bit research tho.
|
|
|
|
|
Here's my version: (I used a RichTextBox because I don't know what that other thing is.)
private void AddTabs ( int tabNumber )
{
System.Windows.Forms.TabPage tabPage = null ;
System.Windows.Forms.RichTextBox shtb;
tabControl.SuspendLayout() ;
tabControl.Controls.Clear() ;
for (int i = 0; i < tabNumber; i++)
{
tabPage = new System.Windows.Forms.TabPage();
tabPage.Location = new System.Drawing.Point(4, 22);
tabPage.Name = "tabPage" + i.ToString();
tabPage.Padding = new System.Windows.Forms.Padding(3);
tabPage.Size = new System.Drawing.Size(403, 386);
tabPage.TabIndex = i;
tabPage.Text = "tabPage " + i.ToString();
tabPage.UseVisualStyleBackColor = true;
shtb = new System.Windows.Forms.RichTextBox();
shtb.Name = "shtb" + i.ToString();
shtb.Location = new System.Drawing.Point(0, 0);
shtb.Dock = System.Windows.Forms.DockStyle.Fill;
tabPage.Controls.Add(shtb);
tabControl.Controls.Add(tabPage);
tabPage.SuspendLayout();
tabPage.ResumeLayout(false);
}
this.Text = "TabText1 - " + tabPage.Text;
tabControl.SelectedIndex = tabControl.Controls.Count - 1;
tabControl.ResumeLayout() ;
}
|
|
|
|
|
I tried entering 0 into the input box and try to add a tab, this time no exception error, but instead, nothing happens.
Where im i going wrong? Why wont this work?
|
|
|
|
|
Okay, i made a silly mistake in the for loop, but here's the fixed version of the for loop code:
for (int i = 0; i < tabNumber; i++)<br />
{<br />
tabPages[i] = new TabPage();<br />
tabPages[i].Location = new System.Drawing.Point(4, 22);<br />
tabPages[i].Name = "tabPage" + i.ToString();<br />
tabPages[i].Padding = new System.Windows.Forms.Padding(3);<br />
tabPages[i].Size = new System.Drawing.Size(403, 386);<br />
tabPages[i].TabIndex = i;<br />
tabPages[i].Text = "tabPage " + i.ToString();<br />
tabPages[i].UseVisualStyleBackColor = true;<br />
<br />
shtb[i] = new SyntaxHighlightingTextBox();<br />
shtb[i].Name = "shtb" + i.ToString();<br />
shtb[i].Location = new Point(0, 0);<br />
shtb[i].Dock = DockStyle.Fill;<br />
<br />
tabPages[i].Controls.Add(shtb[i]);<br />
tabControl.Controls.Add(tabPages[i]);<br />
<br />
tabPages[i].SuspendLayout();<br />
tabPages[i].ResumeLayout(false);<br />
int counter = tabControl.Controls.Count;<br />
tabControl.SelectedIndex = counter - 1;<br />
this.Text = "TabText1 - " + tabPages[i].Text;<br />
}
This compiles correctly, yet, when i run it, i get the exception error again...
|
|
|
|
|
Hello again
well I was thinking abt making a new control that works like the pane windows of Visual Studio 2005 IDE, u know the one's on the right and left corner of the screen which u can choose to auto hide any time showing you properties, solution explorer and tools etc. I know u have to make new user controls or use control customization and I looked into a sample program I got from Codeproject.com and that thing looked kind of over whelming so Can any one of u plz tell me where to start off if any buddy wants to work on these grounds? Is there a comprehensive book on this or some study material over the internet? Plz tell me abt it?
thanks
Rocky
|
|
|
|
|
Just create a new user control in the wizard, and then add things as you need them. Read up on the events that are fired, and think about what you need to do to get to where you want.
You can also derive from an existing control.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
ahh this question might sound a bit too naive but where does that wizard come from that ur talking abt
Christian Graus wrote: Just create a new user control in the wizard
|
|
|
|
|
hi every one,
well I'm having table called users(UserName varchar(15) PK, Password varbinary(256))
plz tell me how to insert data in thi s password field.
There is one way to use a query in the code
like
"insert into users values ('"+UserName+"', Convert(varbinary, '"+pass+"'))";
but I wanted to use the insert function in the table adapter u know. and it requires this passwrd to be byte[]
so how do u convert a string to byte[]
Rocky
|
|
|
|
|
System.Text.Encoding.Unicode.GetBytes ( "Hello world" )
|
|
|
|
|
|
Hello everyone!
Okay. I have a game, and it has weapons. I have code like this:
<code>
abstract class Weapon
{
int power;
}
class W_Handgun : Weapon
{
public W_Handgun()
{
power = 40;
}
}
Well, there will be many different types of weapons. So I'd like to save all of the different types in an XML file instead of hard-coding them.
My question is, how do I do that? I know how to read XML files, but how do I convert something like <Handgun><Power>40</Power></Handgun> to the above mentioned class? I'm lost. (And excuse the smiley.)
Thanks in advance!
Windows Calculator told me I will die at 28.
|
|
|
|
|
Look into XML serialization.
|
|
|
|
|
Oh, so that's how it's done. I won't use this method because it's an online game, and it'll be easy for people to hack it. But thanks!
Windows Calculator told me I will die at 28.
|
|
|
|
|
At least I hope you won't die at 28
|
|
|
|
|
Trust me, I do too.
Windows Calculator told me I will die at 28.
|
|
|
|
|
to store user preference in our application we have an 'hand written' XML file. (as opposed to XmlSerializer written one, which crash sometimes, on some user's computer, for some unknown reason.. but I'm digressing)
In this XML file I store object value, which I convert to string (when writting) and from string (when reading) with a couple of simple function which (should) do a reversible conversion (using TypeConverter) (functions below).
Unfortunately, for some Enum, (namely System.Windows.Forms.Keys) I got a culture dependent string, even though I specify CultureInfo.InvariantCulture as an argument in my ConvertXXX method with the TypeConverter. Even using 'new CultureInfo("en")' do not fix this behavior.
Any tip on how to fix these function (below) so they provide a truly culture independent reversible object=>string=>object mechanism?
===================================================
public static bool TryGetStringValue<T>(object val, out string ret)
{
if (val is string)
{
ret = (string)val;
return true;
}
TypeConverter tc = TypeDescriptor.GetConverter(typeof(T));
if (tc == null)
{
ret = val.ToString();
return false;
}
try
{
ret = tc.ConvertToString(null, CultureInfo.InvariantCulture, val);
return true;
}
catch (ArgumentException) { }
catch (NotSupportedException) { }
ret = val.ToString();
return false;
}
public static bool TryGetTValue<T>(object val, out T tval)
{
if (val is T)
{
tval = (T)val;
return true;
}
TypeConverter tc = TypeDescriptor.GetConverter(typeof(T));
if (tc == null)
{
tval = default(T);
return false;
}
if (!tc.IsValid(val))
{
tval = default(T);
return false;
}
try
{
tval = (T)tc.ConvertFrom(null, CultureInfo.InvariantCulture, val);
return true;
}
catch (ArgumentException) { }
catch (NotSupportedException) { }
tval = default(T);
return false;
}
===================================================
|
|
|
|
|
Doing this breaks databinding of controls
<br />
bindingSourceOnWhichControlsAreBound = bindingSourceWithData;<br />
similary like
<br />
dataSetOnWhichControlsAreBound = dataSetWithData;<br />
However when using DataSet you can do:
<br />
dataSetOnWhichControlsAreBound.Clear;<br />
dataSetOnWhichControlsAreBound.Merge(dataSetWithData);<br />
Is there something similar for bindingSource?
Tnx
|
|
|
|
|
I have a webservice already written and working.. I was able to pull the wsdl from the .asmx page, but I need to generate an XSD. Is there a way to generate the XSD from wither the wsdl or the existing service code? I'm spent the last hour searching the web and came up w/nothing.
Thanks in advance
|
|
|
|
|
Why do you want to generate XSD from WSDL ?
There are many free XSD generators available on net. Just google for it.
"A good programmer is someone who looks both ways before crossing a one-way street." -- Doug Linder
coolestCoder
|
|
|
|
|
Hello
I want to create a form like that you can see in project properties page (Right Click on project name and select properties) in visual studio.net, Is that TabControl or just some buttons with custome effects.
Tank you
|
|
|
|
|
It's a custom control, as is much of VS.NET.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hello,
If u want to get the application just which looks like vs.net then you can try CAB/SCSF from microsoft along with third party controls. and if u r looking for only some design consideration like tabbing, thn i think third party tools will help u in designing in that fashion. One of the third party tool i have used is Infagistics. For tabbing, docking and hide positions(as it is in vs.net) is provided by dockmanager control in Infragistics. There are many third party tools, which u can try as it comes with trial versions.
|
|
|
|