|
I have written the following code in windows
---------------------------------------------
TextBox1.Text = Application.ProductName + "." + acode.Text;
System.Reflection.Assembly tempAssembly = System.Reflection.Assembly.GetExecutingAssembly();
Form frm1 = new Form();
Form frm1 = (Form)tempAssembly.CreateInstance(TextBox1.Text);
frm1.show();
---------------------------------------------
Here error is been generated,in frm1.show() line,object reference not set to an instance of the object.The TextBox1.Text contents are not
been displayed in frm1 which is the instance of Form and getting null
value
Please suggest me the solution to the error above.
Thanks
Ramesh
|
|
|
|
|
There is at least one obvious problem:
Form frm1 = new Form();
Form frm1 = (Form)tempAssembly.CreateInstance(TextBox1.Text);
The first of these two lines sets frm1 to be a new instance of a Form .
The second line then tries to change frm1 into whatever you have in TextBox1.Text , unfortunately whatever you have there cannot be found so frm1 is set to null which is why you are getting the error.
You probably do not need the first line.
If you show an example of what might be in acode.Text people might be better able to help you.
In the interim you might want to try:
Form frm1 = (Form)tempAssembly.CreateInstance(TextBox1.Text, true);
Which tells CreateInstance not to worry about the case of the parameter text, just in case your acode.Text is correct except for the case.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Member 4470223 wrote: Form frm1 = new Form();
Form frm1 = ...;
that does not compile without errors, does it?
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
I'm looking to design a windows form application. My idea for the interface is to have a tree view on the left of my form as a menu structure to navigate between functions and the rest of the form to display the different 'screens'.
Basically what I'm imagining is something that resembles a deck - a vertical stack of screens where only one is visible at a time, similar to a TabControl but without the actual tabs.
My first attempt involved using Panels, but I couldn't switch between the panels in the design view.
Is this sort of functionality possible? if so, any ideas would be greatly appreciated.
|
|
|
|
|
Extend a TabControl. Call it say CustomTabControl. The idea is to remove the tabs. So, you get the functionality you want. There are many articles here on how to have custom tab controls. You basically need to tweak following properties.
ItemSize = (0, 1)
SizeMode = TabSizeMode.Fixed
Appearance = TabAppearance.Buttons
|
|
|
|
|
That seems to do what I wanted. Thanks!
|
|
|
|
|
In my searching I also found a PanelManager created by Mick Doherty:
http://dotnetrix.co.uk/custom.htm[^]
It works similarly, but provides easer navigation between panels.
|
|
|
|
|
hello
dear friends i have a problem
that i have added checkbox in datagrid view its working properly but i want to select all checkboxes at a time can anyone tell me how can i do that
i have added checkbox in gridvew from gridview collection poperty
|
|
|
|
|
You might have to go through this article.
|
|
|
|
|
I think this is a windows forms. The article corresponds only to ASP.Net.
|
|
|
|
|
|
What would be the most practical Regex pattern for a whole-word-only search?
Example: Match "life" but not "life's"
|
|
|
|
|
Okay, never mind. NOW I know what the ExplicitCapture option does.
|
|
|
|
|
Hello
i need some help
i have developed a sms software on c# ,i have used gsmcommm and pduconverter its working but its just sending 160 char message and i need to send long messsages can any one help me plzzzz
Regards
|
|
|
|
|
You should have found out what SMS stands for first and how it works, Short Message Service. The message limit is 160 characters by specification. You'll have to break up longer messages into multiple 160 character limit messages.
|
|
|
|
|
can you plz guide me how can i break up message and send it
when i breakup message will reciever get it in one message or in multiple messages?
|
|
|
|
|
You've got to be kidding me?? You mean to tell me that you don't have the skill to get the Length of a string (your message) and how to grab SubStrings of 160 characters in length? If you can't do this, then I highly suggest picking up a beginners book on C# and working through it before you attempt to write another application. This is very basic "Strings 101" stuff you're asking about.
|
|
|
|
|
i know how to break up message after 159 char but when i break it in to mutiple messages and send it to any number the reciever recieve it in multiple messages
the thing i want is that when i send it the reciever got it in a single message.
|
|
|
|
|
eraser950 wrote: i want is that when i send it the reciever got it in a single message.
You have no control over how the reciever recombines, or more acurately, does NOT recombine them. You cannot force the reciever to put the message back the way you want it. They will get each as a seperate message and there is nothing you can do about it. Thatose are the limitations you chose to tolerate when you chose to use SMS as a communication medium.
|
|
|
|
|
|
Maybe, but maybe not:
In the cellular phone industry, mobile phones and their networks sometimes support concatenated short message service (or concatenated SMS)
|
|
|
|
|
You can download the technical specification here[^] (registration required)
You want to look for PDU mode SMS. Note that concatenated SMS is quite a complex subject ( because the order of delivery of sms messages is not guaranteed, enough information must be included to allow message re-assembly on the receiving side. Your ability to send concatenated SMS will depend on
- the library you use for sending messages (don't know the ones you mention)
- the ability of the phone on the other end to decode concatenated SMS (most phones do it nowadays)
If you want to read up on it before embarking on an adventure, have a read here[^].
|
|
|
|
|
|
I have a datatable that acts as a DataSource for control. Programmatically I am also deleting some rows from this table using code like
foreach (DataRow row in myDataTable.Rows)
{
if (row["Id"].ToString().CompareTo(myControl.SelectedValue.ToString()) == 0)
{
row.Delete();
break;
}
}
I am not calling AcceptChanges on datatable. However after this delete, I don’t see any rows that have a status DataViewRowState.Deleted
Any ideas what I may be missing?
|
|
|
|
|
I have this test code where I can see the same behavior. Can someone point what am I doing wrong here?
static void Main(string[] args)
{
DataTable table = new DataTable();
DataColumn col = new DataColumn("ID", System.Type.GetType("System.Int32"));
table.Columns.Add(col);
for (int i = 0; i < 10; i++)
{
DataRow row = table.NewRow();
row["ID"] = i;
table.Rows.Add(row);
}
Console.WriteLine(table.Rows.Count);
for (int i = 0; i < table.Rows.Count;i++ )
{
if (Convert.ToInt32(table.Rows[i]["ID"]) == 4)
{
table.Rows[i].Delete();
break;
}
}
Console.WriteLine(table.Rows.Count);
DataTable deletedRows = table.GetChanges(DataRowState.Deleted); // This returns NULL, shouldn't it have one row here???
for (int i = 0; i < deletedRows.Rows.Count; i++)
{
Console.WriteLine("Deleted: " + deletedRows.Rows[i]["ID",DataRowVersion.Original].ToString());
}
}
|
|
|
|